Public report of jundot/omlx, published 4 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.2). 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, 4 November 2026, 21:20 UTC · Survey ID cd_7d35789e6a65479b866dfa36a7080cfc
jundot/omlx
Measured 4 November 2026, 21:18 UTC, at code version 4213c32
CAI scoreWeak
CriticalWeakAdequateStrongExemplary
No change since the last survey
The score is built from these lenses. Each lens grades one area of the code, such as how easy it is to change or how well it is protected. The weakest lens counts most, so one weak area pulls the score down instead of being averaged away.
A large codebase: 326,990 lines of product code in 2 projects, tests not counted · Estimated rebuild effort: about 3.6 person-years · Weakest lens: Code Health, 24
Findings by how serious they are
75 critical2348 serious156 minor
16 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
4 November 2026, 21:18 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 ▸
79of 79 dimensions measured by tools.
2562of 2579 findings point to an exact file and line, so you can open each one in the code. The other 17 concern the repository as a whole, such as missing documentation.
79dimensions across 8 lenses, read from 326,990 lines of product code in 2 projects.
jundot/omlx falls short of our standard for a preview release, held back most by its Code Health lens, the quality of the code itself. It scores 37 out of 100 and is rated Weak, and eight of its 75 critical findings are security problems.
Code Health, at 24, is the weakest lens and counts most in the score. The best first step is fixing the password or key in the code, worth about 4 points. Adding type checking would lift Code Health itself, also worth about 4. Raising Code Health to 67 would lift the score to about 47.
Two pipeline steps install packages that can change without warning. One automatic update takes new releases before a bad one can be spotted, and twenty-five controls can't be used without a mouse. Pinning what the pipeline installs, setting a waiting period for automatic updates and making the controls work with a keyboard would close these risks. Passing outside input through environment variables would fix the pipeline step that puts outside input straight into a shell command, and fixing the weaknesses the scanner points to would deal with the security weakness in the code. The 16 labels or groups of fields with no name need connecting to their fields or naming.
The product code is 326,990 lines, about €530,000 to rebuild.
A lens is capped at Adequate while one of its dimensions scores below 4 out of 10, however well the rest of the lens does. That way a serious problem in one place always shows in the lens's rating.
How the score is built: what each lens counts forThe lenses don't count equally. The weakest lens counts most, the next weakest a little less, and so on, so a weak area pulls the score down instead of being averaged away. In the bar below, each part's width shows how much that lens counts and its colour shows its rating. Improving the widest part moves the score most, and as that lens improves, it counts for less, because another lens becomes the weakest.
If Code Health rose from 24 to 67, the lowest score rated Strong, the score would rise from 37 to about 47.
Code composition: what the lines of code are
Product code 53%Tests 47%
New since the last survey: 266 findings
These 266 critical or serious findings weren't in the previous survey, on 20 October 2026. The first 100 are listed here, and the findings file in the download package lists them all.
We compare every finding with the previous survey's. A finding that has only moved to another line in the same file counts as the same finding, so only new findings appear here. Advisory notes from the AI model are left out, because the model words them afresh in every survey.
Fixed since the last survey: 784 findings
These 784 critical or serious findings were in the previous survey, on 20 October 2026, and are gone from this one. The first 100 are listed here.
€170,000 to €880,000, for 2,911 to 9,235 hours of work, about 3.6 person-years for 2 to 7 engineers
Difficulty of the problem
Standard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor
×0.7 at a score of 37. 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
Large: 326,990 lines of product code
What it is not
Not a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.
How the estimate is made: We price the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.
Top priorities
The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.
1
Resolve the 1 Leaked secret finding(s) in Secret Scanning — start with REDACTED.
Raises the score by about 4 points · Low effort · Secret Scanning
2
Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up.
Raises the score by about 4 points · Medium effort · Type Safety
3
Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.
Raises the score by about 4 points · Medium effort · Large Files
Diagnosis: what the measurements show together
Each conclusion below combines several dimensions into one point that no single dimension shows, and lists the measurements it rests on.
Where the investment is most exposed · Value at risk
This code would cost about €530,000 to build again, about 3.6 person-years of work. Its weakest lens is Code Health, at 24 (Critical). Code Health is about how easy the code is to read and change safely, and code that is hard to read is slow and risky to change, so every future change costs more than it should. Because the weakest lens counts most in the score, work on Code Health also moves the score most.
Based on: the rebuild estimate · the Code Health grade · how much each lens counts
What to do: Start with the Code Health actions in Top priorities.
If you do one thing first · First action
Resolve the 1 Leaked secret finding(s) in Secret Scanning. Of all the actions in this report, it raises the score most for the work it takes: about 4 points for low effort, because it clears the 1 Secret Scanning findings. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 5.8 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 6% to 13% on every change. The history of the code shows how much it changes: about 576,386 lines over the last 90 days, which is about 2,337,565 lines a year. At that pace, the extra work comes to an estimated 327.1 to 1962.9 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.
404 modules, with 237 dependencies between them. One loop runs through 8 of the modules, marked above the diagonal.
The table shows the 40 modules with the most connections; 364 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.
apps~omlx-mac~Server uses apps~omlx-mac~Net, so a change to apps~omlx-mac~Net can break apps~omlx-mac~Server, while a change to apps~omlx-mac~Server can't break apps~omlx-mac~Net.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
19→35 apps~omlx-mac~Server uses apps~omlx-mac~Updaterpart of a loop✕
Connections
10 pairs of types, where a type in apps~omlx-mac~Server uses a type in apps~omlx-mac~Updater.
apps~omlx-mac~Server uses apps~omlx-mac~Updater, so a change to apps~omlx-mac~Updater can break apps~omlx-mac~Server, while a change to apps~omlx-mac~Server can't break apps~omlx-mac~Updater.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
19→37 apps~omlx-mac~Server uses apps~omlx-mac~AskAIpart of a loop✕
Connections
3 pairs of types, where a type in apps~omlx-mac~Server uses a type in apps~omlx-mac~AskAI.
apps~omlx-mac~Server uses apps~omlx-mac~AskAI, so a change to apps~omlx-mac~AskAI can break apps~omlx-mac~Server, while a change to apps~omlx-mac~Server can't break apps~omlx-mac~AskAI.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
20→33 apps~omlx-mac~Theme uses apps~omlx-mac~Netpart of a loop✕
Connections
1 pair of types, where a type in apps~omlx-mac~Theme uses a type in apps~omlx-mac~Net.
apps~omlx-mac~Theme uses apps~omlx-mac~Net, so a change to apps~omlx-mac~Net can break apps~omlx-mac~Theme, while a change to apps~omlx-mac~Theme can't break apps~omlx-mac~Net.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
20→35 apps~omlx-mac~Theme uses apps~omlx-mac~Updaterpart of a loop✕
Connections
16 pairs of types, where a type in apps~omlx-mac~Theme uses a type in apps~omlx-mac~Updater.
apps~omlx-mac~Theme uses apps~omlx-mac~Updater, so a change to apps~omlx-mac~Updater can break apps~omlx-mac~Theme, while a change to apps~omlx-mac~Theme can't break apps~omlx-mac~Updater.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
20→37 apps~omlx-mac~Theme uses apps~omlx-mac~AskAIpart of a loop✕
Connections
2 pairs of types, where a type in apps~omlx-mac~Theme uses a type in apps~omlx-mac~AskAI.
apps~omlx-mac~Theme uses apps~omlx-mac~AskAI, so a change to apps~omlx-mac~AskAI can break apps~omlx-mac~Theme, while a change to apps~omlx-mac~Theme can't break apps~omlx-mac~AskAI.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
omlx.api uses omlx.api.openai_models, so a change to omlx.api.openai_models can break omlx.api, while a change to omlx.api can't break omlx.api.openai_models.
Position
Below the diagonal: omlx.api uses a module listed above it, which is the healthy direction.
omlx.api uses omlx.engine.realtime_voice, so a change to omlx.engine.realtime_voice can break omlx.api, while a change to omlx.api can't break omlx.engine.realtime_voice.
Position
Below the diagonal: omlx.api uses a module listed above it, which is the healthy direction.
omlx.cache.interface uses omlx.cache.stats, so a change to omlx.cache.stats can break omlx.cache.interface, while a change to omlx.cache.interface can't break omlx.cache.stats.
Position
Below the diagonal: omlx.cache.interface uses a module listed above it, which is the healthy direction.
omlx.cluster uses omlx.cluster.deployment, so a change to omlx.cluster.deployment can break omlx.cluster, while a change to omlx.cluster can't break omlx.cluster.deployment.
Position
Below the diagonal: omlx.cluster uses a module listed above it, which is the healthy direction.
omlx.cluster.rdma uses omlx.cluster.rdma.mailbox, so a change to omlx.cluster.rdma.mailbox can break omlx.cluster.rdma, while a change to omlx.cluster.rdma can't break omlx.cluster.rdma.mailbox.
Position
Below the diagonal: omlx.cluster.rdma uses a module listed above it, which is the healthy direction.
omlx.engine.distributed uses omlx.cluster.deployment, so a change to omlx.cluster.deployment can break omlx.engine.distributed, while a change to omlx.engine.distributed can't break omlx.cluster.deployment.
Position
Below the diagonal: omlx.engine.distributed uses a module listed above it, which is the healthy direction.
omlx.engine.distributed uses omlx.engine.base, so a change to omlx.engine.base can break omlx.engine.distributed, while a change to omlx.engine.distributed can't break omlx.engine.base.
Position
Below the diagonal: omlx.engine.distributed uses a module listed above it, which is the healthy direction.
omlx.engine.splash uses omlx.engine.base, so a change to omlx.engine.base can break omlx.engine.splash, while a change to omlx.engine.splash can't break omlx.engine.base.
Position
Below the diagonal: omlx.engine.splash uses a module listed above it, which is the healthy direction.
omlx.mcp.manager uses omlx.mcp.types, so a change to omlx.mcp.types can break omlx.mcp.manager, while a change to omlx.mcp.manager can't break omlx.mcp.types.
Position
Below the diagonal: omlx.mcp.manager uses a module listed above it, which is the healthy direction.
omlx.patches.deepseek_v41_mlx_lm.model uses omlx.patches.deepseek_v41.config, so a change to omlx.patches.deepseek_v41.config can break omlx.patches.deepseek_v41_mlx_lm.model, while a change to omlx.patches.deepseek_v41_mlx_lm.model can't break omlx.patches.deepseek_v41.config.
Position
Below the diagonal: omlx.patches.deepseek_v41_mlx_lm.model uses a module listed above it, which is the healthy direction.
omlx.patches.deepseek_v41_mlx_lm.model uses omlx.patches.deepseek_v41.language, so a change to omlx.patches.deepseek_v41.language can break omlx.patches.deepseek_v41_mlx_lm.model, while a change to omlx.patches.deepseek_v41_mlx_lm.model can't break omlx.patches.deepseek_v41.language.
Position
Below the diagonal: omlx.patches.deepseek_v41_mlx_lm.model uses a module listed above it, which is the healthy direction.
apps~omlx-mac~Menubar uses apps~omlx-mac~Server, so a change to apps~omlx-mac~Server can break apps~omlx-mac~Menubar, while a change to apps~omlx-mac~Menubar can't break apps~omlx-mac~Server.
Position
Below the diagonal: apps~omlx-mac~Menubar uses a module listed above it, which is the healthy direction.
apps~omlx-mac~Menubar uses apps~omlx-mac~Theme, so a change to apps~omlx-mac~Theme can break apps~omlx-mac~Menubar, while a change to apps~omlx-mac~Menubar can't break apps~omlx-mac~Theme.
Position
Below the diagonal: apps~omlx-mac~Menubar uses a module listed above it, which is the healthy direction.
29→33 apps~omlx-mac~Menubar uses apps~omlx-mac~Netpart of a loop✕
Connections
4 pairs of types, where a type in apps~omlx-mac~Menubar uses a type in apps~omlx-mac~Net.
apps~omlx-mac~Menubar uses apps~omlx-mac~Net, so a change to apps~omlx-mac~Net can break apps~omlx-mac~Menubar, while a change to apps~omlx-mac~Menubar can't break apps~omlx-mac~Net.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
29→35 apps~omlx-mac~Menubar uses apps~omlx-mac~Updaterpart of a loop✕
Connections
28 pairs of types, where a type in apps~omlx-mac~Menubar uses a type in apps~omlx-mac~Updater. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
apps~omlx-mac~Menubar uses apps~omlx-mac~Updater, so a change to apps~omlx-mac~Updater can break apps~omlx-mac~Menubar, while a change to apps~omlx-mac~Menubar can't break apps~omlx-mac~Updater.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
29→36 apps~omlx-mac~Menubar uses apps~omlx-mac~Configpart of a loop✕
Connections
1 pair of types, where a type in apps~omlx-mac~Menubar uses a type in apps~omlx-mac~Config.
apps~omlx-mac~Menubar uses apps~omlx-mac~Config, so a change to apps~omlx-mac~Config can break apps~omlx-mac~Menubar, while a change to apps~omlx-mac~Menubar can't break apps~omlx-mac~Config.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
29→37 apps~omlx-mac~Menubar uses apps~omlx-mac~AskAIpart of a loop✕
Connections
5 pairs of types, where a type in apps~omlx-mac~Menubar uses a type in apps~omlx-mac~AskAI.
apps~omlx-mac~Menubar uses apps~omlx-mac~AskAI, so a change to apps~omlx-mac~AskAI can break apps~omlx-mac~Menubar, while a change to apps~omlx-mac~Menubar can't break apps~omlx-mac~AskAI.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
omlx.cache.paged_cache uses omlx.cache.stats, so a change to omlx.cache.stats can break omlx.cache.paged_cache, while a change to omlx.cache.paged_cache can't break omlx.cache.stats.
Position
Below the diagonal: omlx.cache.paged_cache uses a module listed above it, which is the healthy direction.
omlx.cache.paged_cache uses omlx.cache.interface, so a change to omlx.cache.interface can break omlx.cache.paged_cache, while a change to omlx.cache.paged_cache can't break omlx.cache.interface.
Position
Below the diagonal: omlx.cache.paged_cache uses a module listed above it, which is the healthy direction.
omlx.engine uses omlx.cluster.deployment, so a change to omlx.cluster.deployment can break omlx.engine, while a change to omlx.engine can't break omlx.cluster.deployment.
Position
Below the diagonal: omlx.engine uses a module listed above it, which is the healthy direction.
omlx.engine uses omlx.engine.realtime_voice, so a change to omlx.engine.realtime_voice can break omlx.engine, while a change to omlx.engine can't break omlx.engine.realtime_voice.
Position
Below the diagonal: omlx.engine uses a module listed above it, which is the healthy direction.
omlx.engine uses omlx.engine.splash, so a change to omlx.engine.splash can break omlx.engine, while a change to omlx.engine can't break omlx.engine.splash.
Position
Below the diagonal: omlx.engine uses a module listed above it, which is the healthy direction.
omlx.engine_pool uses omlx.cluster.deployment, so a change to omlx.cluster.deployment can break omlx.engine_pool, while a change to omlx.engine_pool can't break omlx.cluster.deployment.
Position
Below the diagonal: omlx.engine_pool uses a module listed above it, which is the healthy direction.
omlx.engine_pool uses omlx.engine.splash, so a change to omlx.engine.splash can break omlx.engine_pool, while a change to omlx.engine_pool can't break omlx.engine.splash.
Position
Below the diagonal: omlx.engine_pool uses a module listed above it, which is the healthy direction.
apps~omlx-mac~Net uses apps~omlx-mac~Menubar, so a change to apps~omlx-mac~Menubar can break apps~omlx-mac~Net, while a change to apps~omlx-mac~Net can't break apps~omlx-mac~Menubar.
Position
Below the diagonal: apps~omlx-mac~Net uses a module listed above it, which is the healthy direction.
33→35 apps~omlx-mac~Net uses apps~omlx-mac~Updaterpart of a loop✕
Connections
113 pairs of types, where a type in apps~omlx-mac~Net uses a type in apps~omlx-mac~Updater. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
apps~omlx-mac~Net uses apps~omlx-mac~Updater, so a change to apps~omlx-mac~Updater can break apps~omlx-mac~Net, while a change to apps~omlx-mac~Net can't break apps~omlx-mac~Updater.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
omlx.cache.prefix_cache uses omlx.cache.stats, so a change to omlx.cache.stats can break omlx.cache.prefix_cache, while a change to omlx.cache.prefix_cache can't break omlx.cache.stats.
Position
Below the diagonal: omlx.cache.prefix_cache uses a module listed above it, which is the healthy direction.
omlx.cache.prefix_cache uses omlx.cache.interface, so a change to omlx.cache.interface can break omlx.cache.prefix_cache, while a change to omlx.cache.prefix_cache can't break omlx.cache.interface.
Position
Below the diagonal: omlx.cache.prefix_cache uses a module listed above it, which is the healthy direction.
omlx.cache.prefix_cache uses omlx.cache.paged_cache, so a change to omlx.cache.paged_cache can break omlx.cache.prefix_cache, while a change to omlx.cache.prefix_cache can't break omlx.cache.paged_cache.
Position
Below the diagonal: omlx.cache.prefix_cache uses a module listed above it, which is the healthy direction.
apps~omlx-mac~Updater uses apps~omlx-mac~Net, so a change to apps~omlx-mac~Net can break apps~omlx-mac~Updater, while a change to apps~omlx-mac~Updater can't break apps~omlx-mac~Net.
Position
Below the diagonal: apps~omlx-mac~Updater uses a module listed above it, which is the healthy direction.
apps~omlx-mac~Config uses apps~omlx-mac~Updater, so a change to apps~omlx-mac~Updater can break apps~omlx-mac~Config, while a change to apps~omlx-mac~Config can't break apps~omlx-mac~Updater.
Position
Below the diagonal: apps~omlx-mac~Config uses a module listed above it, which is the healthy direction.
apps~omlx-mac~AskAI uses apps~omlx-mac~Theme, so a change to apps~omlx-mac~Theme can break apps~omlx-mac~AskAI, while a change to apps~omlx-mac~AskAI can't break apps~omlx-mac~Theme.
Position
Below the diagonal: apps~omlx-mac~AskAI uses a module listed above it, which is the healthy direction.
apps~omlx-mac~AskAI uses apps~omlx-mac~Net, so a change to apps~omlx-mac~Net can break apps~omlx-mac~AskAI, while a change to apps~omlx-mac~AskAI can't break apps~omlx-mac~Net.
Position
Below the diagonal: apps~omlx-mac~AskAI uses a module listed above it, which is the healthy direction.
59 pairs of types, where a type in apps~omlx-mac~AskAI uses a type in apps~omlx-mac~Updater. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
apps~omlx-mac~AskAI uses apps~omlx-mac~Updater, so a change to apps~omlx-mac~Updater can break apps~omlx-mac~AskAI, while a change to apps~omlx-mac~AskAI can't break apps~omlx-mac~Updater.
Position
Below the diagonal: apps~omlx-mac~AskAI uses a module listed above it, which is the healthy direction.
apps~omlx-mac~AskAI uses apps~omlx-mac~Config, so a change to apps~omlx-mac~Config can break apps~omlx-mac~AskAI, while a change to apps~omlx-mac~AskAI can't break apps~omlx-mac~Config.
Position
Below the diagonal: apps~omlx-mac~AskAI uses a module listed above it, which is the healthy direction.
37→38 apps~omlx-mac~AskAI uses apps~omlx-mac~AppViewpart of a loop✕
Connections
2 pairs of types, where a type in apps~omlx-mac~AskAI uses a type in apps~omlx-mac~AppView.
apps~omlx-mac~AskAI uses apps~omlx-mac~AppView, so a change to apps~omlx-mac~AppView can break apps~omlx-mac~AskAI, while a change to apps~omlx-mac~AskAI can't break apps~omlx-mac~AppView.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
apps~omlx-mac~AppView uses apps~omlx-mac~Server, so a change to apps~omlx-mac~Server can break apps~omlx-mac~AppView, while a change to apps~omlx-mac~AppView can't break apps~omlx-mac~Server.
Position
Below the diagonal: apps~omlx-mac~AppView uses a module listed above it, which is the healthy direction.
182 pairs of types, where a type in apps~omlx-mac~AppView uses a type in apps~omlx-mac~Theme. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
apps~omlx-mac~AppView uses apps~omlx-mac~Theme, so a change to apps~omlx-mac~Theme can break apps~omlx-mac~AppView, while a change to apps~omlx-mac~AppView can't break apps~omlx-mac~Theme.
Position
Below the diagonal: apps~omlx-mac~AppView uses a module listed above it, which is the healthy direction.
151 pairs of types, where a type in apps~omlx-mac~AppView uses a type in apps~omlx-mac~Net. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
apps~omlx-mac~AppView uses apps~omlx-mac~Net, so a change to apps~omlx-mac~Net can break apps~omlx-mac~AppView, while a change to apps~omlx-mac~AppView can't break apps~omlx-mac~Net.
Position
Below the diagonal: apps~omlx-mac~AppView uses a module listed above it, which is the healthy direction.
149 pairs of types, where a type in apps~omlx-mac~AppView uses a type in apps~omlx-mac~Updater. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
apps~omlx-mac~AppView uses apps~omlx-mac~Updater, so a change to apps~omlx-mac~Updater can break apps~omlx-mac~AppView, while a change to apps~omlx-mac~AppView can't break apps~omlx-mac~Updater.
Position
Below the diagonal: apps~omlx-mac~AppView uses a module listed above it, which is the healthy direction.
apps~omlx-mac~AppView uses apps~omlx-mac~Config, so a change to apps~omlx-mac~Config can break apps~omlx-mac~AppView, while a change to apps~omlx-mac~AppView can't break apps~omlx-mac~Config.
Position
Below the diagonal: apps~omlx-mac~AppView uses a module listed above it, which is the healthy direction.
apps~omlx-mac~AppView uses apps~omlx-mac~AskAI, so a change to apps~omlx-mac~AskAI can break apps~omlx-mac~AppView, while a change to apps~omlx-mac~AppView can't break apps~omlx-mac~AskAI.
Position
Below the diagonal: apps~omlx-mac~AppView uses a module listed above it, which is the healthy direction.
apps~omlx-mac~Welcome uses apps~omlx-mac~Server, so a change to apps~omlx-mac~Server can break apps~omlx-mac~Welcome, while a change to apps~omlx-mac~Welcome can't break apps~omlx-mac~Server.
Position
Below the diagonal: apps~omlx-mac~Welcome uses a module listed above it, which is the healthy direction.
apps~omlx-mac~Welcome uses apps~omlx-mac~Theme, so a change to apps~omlx-mac~Theme can break apps~omlx-mac~Welcome, while a change to apps~omlx-mac~Welcome can't break apps~omlx-mac~Theme.
Position
Below the diagonal: apps~omlx-mac~Welcome uses a module listed above it, which is the healthy direction.
apps~omlx-mac~Welcome uses apps~omlx-mac~Net, so a change to apps~omlx-mac~Net can break apps~omlx-mac~Welcome, while a change to apps~omlx-mac~Welcome can't break apps~omlx-mac~Net.
Position
Below the diagonal: apps~omlx-mac~Welcome uses a module listed above it, which is the healthy direction.
apps~omlx-mac~Welcome uses apps~omlx-mac~Updater, so a change to apps~omlx-mac~Updater can break apps~omlx-mac~Welcome, while a change to apps~omlx-mac~Welcome can't break apps~omlx-mac~Updater.
Position
Below the diagonal: apps~omlx-mac~Welcome uses a module listed above it, which is the healthy direction.
apps~omlx-mac~Welcome uses apps~omlx-mac~AppView, so a change to apps~omlx-mac~AppView can break apps~omlx-mac~Welcome, while a change to apps~omlx-mac~Welcome can't break apps~omlx-mac~AppView.
Position
Below the diagonal: apps~omlx-mac~Welcome uses a module listed above it, which is the healthy direction.
apps~omlx-mac~App uses apps~omlx-mac~Server, so a change to apps~omlx-mac~Server can break apps~omlx-mac~App, while a change to apps~omlx-mac~App can't break apps~omlx-mac~Server.
Position
Below the diagonal: apps~omlx-mac~App uses a module listed above it, which is the healthy direction.
apps~omlx-mac~App uses apps~omlx-mac~Menubar, so a change to apps~omlx-mac~Menubar can break apps~omlx-mac~App, while a change to apps~omlx-mac~App can't break apps~omlx-mac~Menubar.
Position
Below the diagonal: apps~omlx-mac~App uses a module listed above it, which is the healthy direction.
apps~omlx-mac~App uses apps~omlx-mac~Net, so a change to apps~omlx-mac~Net can break apps~omlx-mac~App, while a change to apps~omlx-mac~App can't break apps~omlx-mac~Net.
Position
Below the diagonal: apps~omlx-mac~App uses a module listed above it, which is the healthy direction.
apps~omlx-mac~App uses apps~omlx-mac~Updater, so a change to apps~omlx-mac~Updater can break apps~omlx-mac~App, while a change to apps~omlx-mac~App can't break apps~omlx-mac~Updater.
Position
Below the diagonal: apps~omlx-mac~App uses a module listed above it, which is the healthy direction.
apps~omlx-mac~App uses apps~omlx-mac~Config, so a change to apps~omlx-mac~Config can break apps~omlx-mac~App, while a change to apps~omlx-mac~App can't break apps~omlx-mac~Config.
Position
Below the diagonal: apps~omlx-mac~App uses a module listed above it, which is the healthy direction.
apps~omlx-mac~App uses apps~omlx-mac~AppView, so a change to apps~omlx-mac~AppView can break apps~omlx-mac~App, while a change to apps~omlx-mac~App can't break apps~omlx-mac~AppView.
Position
Below the diagonal: apps~omlx-mac~App uses a module listed above it, which is the healthy direction.
apps~omlx-mac~App uses apps~omlx-mac~Welcome, so a change to apps~omlx-mac~Welcome can break apps~omlx-mac~App, while a change to apps~omlx-mac~App can't break apps~omlx-mac~Welcome.
Position
Below the diagonal: apps~omlx-mac~App uses a module listed above it, which is the healthy direction.
At a glance — Code Health · 24% · Weak · gated by D1, D2, R1, R2, R3, X5 ·
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
52
High / Critical
A03:2025 — Software Supply Chain Failures
3
Medium
A07:2025 — Authentication Failures
1
High / Critical
Roadmap
Top priorities: Resolve the 1 Leaked secret finding(s) in Secret Scanning — start with REDACTED; Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up; Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Resolve the 1 Leaked secret finding(s) in Secret Scanning — start with REDACTED.
Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up.
Bring the 91 bodies over 60 down to 60 or less in Cognitive Complexity — start with BlockAwarePrefixCache.reconstruct_cache (cognitive 653), routes.update_global_settings (cognitive 469), chat.html.chatApp (cognitive 459).
Adopt a checker and raise it file by file: with Sorbet, `srb init` (or `bundle exec tapioca init`) commits `sorbet/config`, then move each file's sigil from `# typed: false` to `# typed: true` and on to `strict` as its methods get `sig`s — `spoom bump` does the moving; with Steep, write RBS signatures and `check` the product directories in the `Steepfile` under `D::Ruby.default` or `strict`, not `lenient`. Then pay down the assertions rather than adding to them: each `T.must` is a nil the checker could not rule out — narrow it (`return unless x`, `x&.`, `if (y = x)`), make the attribute non-nilable and set it in `initialize`, or change the method so the nil cannot arrive.
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 — 75
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 — 2348
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 — 156
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 16
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 79 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 — 79 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, 2562 of 2579 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.
D8 Code Coverage — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT MEASURED: test source is present (.py, .swift, .cjs, .rb) but the built-in coverage collector has no runner for this repository's ecosystem — so this suite was never executed by it. Not scored — this is a gap in the analyzer's language coverage, not a defect in the repo. To have real coverage read, produce a coverage report in a standard format (`coverage run -m pytest` then `coverage xml`, or lcov — `swift test --enable-code-coverage` (SwiftPM) or `xcodebuild test -scheme <YourScheme> -enableCodeCoverage YES` (an .xcodeproj/.xcworkspace suite), then `xcrun llvm-cov export -format=lcov`, or lcov — `vitest --coverage`, `jest --coverage`, `bun test --coverage --coverage-reporter=lcov`, or `nyc`, or SimpleCov — `require "simplecov"` in your `spec_helper.rb`/`test_helper.rb`, which writes `coverage/.resultset.json` (or lcov via `simplecov-lcov`)) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures. You can widen what we reach: optional: produce a coverage report in a standard format (`coverage run -m pytest` then `coverage xml`, or lcov — `swift test --enable-code-coverage` (SwiftPM) or `xcodebuild test -scheme <YourScheme> -enableCodeCoverage YES` (an .xcodeproj/.xcworkspace suite), then `xcrun llvm-cov export -format=lcov`, or lcov — `vitest --coverage`, `jest --coverage`, `bun test --coverage --coverage-reporter=lcov`, or `nyc`, or SimpleCov — `require "simplecov"` in your `spec_helper.rb`/`test_helper.rb`, which writes `coverage/.resultset.json` (or lcov via `simplecov-lcov`)) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures — then the real number is read on the next scan.
D10 Test Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. The 28 test(s) behind this row are the ones the JavaScript/TypeScript census could read, and this repository also carries at least 558 test source file(s) (.py, .swift, .rb) that it cannot: it reads JavaScript/TypeScript test declarations off disk, so a JUnit/pytest-style suite is invisible to it. Skipped tests, zero-assertion tests and the other quality signals on this row are UNMEASURED in that suite — their absence from the counts above is a gap in this analyzer's language coverage, not a finding that those tests are sound.
D11 Test Reliability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test source is present (.py, .swift, .cjs, .rb) and this repository declares a Python test suite (repository root, 519 test files), but it was not re-run: no test result was produced. Not scored — this is a gap in the analyzer's language coverage, not a finding about this repository.
D19 Documentation Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each ecosystem's manifests (what makes a folder runnable or a published package) need their own proof before D19 judges its units. Until then those folders' READMEs are judged only as documents (boilerplate, structure), never counted as complete.
D21 Naming Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D21's deterministic naming rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. Until then its declarations carry no naming verdict this run — this says nothing about whether its names are consistent.
D22 Internal API Consistency — not measured this run — 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 a COLLECTOR gap, not an environment fault: it declares a published package (setup.py), but no published-package marker D22 reads admitted any project here, so this ecosystem's public API has no collector, and the remedy is to write one — no change to the scan image can close it.
D24 Comment Value — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each source language's comment syntax, and the code a comment annotates in it, needs its own proof before D24 judges it. Until then those comments are left unread, not counted as clean.
D28 Secrets (history) — 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. `gitleaks` TIMED OUT after 180.4s against a 180s budget, so we killed its process tree. The budget is ours; the work may simply be larger than it allows. Nothing about this repository is asserted by the absence of a result; the budget is ours to raise, and raising it is our backlog item, not an action for this repository's owner.
D32 Data Compliance (PII/GDPR) — 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. `apps/omlx-mac/Sources/AppView/AppView.swift`, `apps/omlx-mac/Sources/AppView/Screens/AppearanceScreen.swift`, `apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift`, `apps/omlx-mac/Sources/AppView/Utils/LogRecords.swift`, `apps/omlx-mac/Sources/AppView/ViewModels/IntegrationsScreenVM.swift`, … (+21 more) produced a parse error, so every rule in this engine's `gdpr.yml` was absent there. That absence is NOT a clean result: these rules detect personal data crossing a boundary into a log sink, a URL or browser storage, and a file that was never parsed cannot report any of the three. The rest of the tree analysed normally and its rows above stand; only these files are unaccounted for. You can widen what we reach: fix the syntax error (or exclude the file deliberately) and re-scan to cover it.
AC2 Forms & labels — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 339 further occurrence(s) are not listed individually; the score already reflects all 379.
AC6 Visual & motion safety — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 12 further occurrence(s) are not listed individually; the score already reflects all 52.
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 REDACTED, whose lifetimes are not modelled yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
AXR1 Runtime accessibility — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Render strategy: boot via ToolchainServer (.). the service exited before it opened a port — `/tmp/wd-venv/bin/python -m uvicorn 'omlx.server:app' --host 127.0.0.1 --port 8000`: 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 995, in exec_module
File "<frozen importlib…; runtime evidence skipped (launch chosen because REDACTED defines the FastAPI application 'app' at module level).
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.
C2 Access Controls — 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 authorization controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks authorization controls.
C3 Audit Trail — not measured this run — 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 audit controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks audit controls.
C4 Data Retention — not measured this run — 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 retention controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks retention controls.
C5 Data-Subject Rights — not measured this run — 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 data-subject rights controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks data-subject rights controls.
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 and Scala source only, and this repository's Python, Swift, c, cpp, objectivec is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
IC1 Incompleteness & stubs — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby and Scala source only, and this repository's Python, Swift, c, cpp, objectivec is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
M4 Documentation accuracy — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9), and artefact counts an order of magnitude off. Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
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.
R10 Code Duplication — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 2 further occurrence(s) are not listed individually; the score already reflects all 42.
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.
X2 Cancellation propagation — 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. 59 further occurrence(s) are not listed individually; the score already reflects all 99.
X3 Exception handling — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 286 further occurrence(s) are not listed individually; the score already reflects all 326.
X4 Structured logging — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 737 further occurrence(s) are not listed individually; the score already reflects all 777.
X7 Silent fallback defaults — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 11 further occurrence(s) are not listed individually; the score already reflects all 51.
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.
D9 Test Distribution: The test-pyramid shape is inferred from project/folder naming and references, with a single test host bucketed per-file by its path tier and content signals — a suite that names tiers unconventionally and gives no per-file signal can still be mis-bucketed.
D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
D13 Secret Scanning: Secret detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
D19 Documentation Quality: Documentation quality publishes two things only: a runnable or packaged unit with no example, and a multi-project root README that maps none of its parts. It does not judge clarity, and its other checks (overview, licence, boilerplate, structure, empty sections, XML-doc coverage) are withheld after adjudication: their candidates are counted in the card's gaps, not shown as rows. A false statement in a document is M4's; units are .NET projects only.
D20 ADR Quality: ADR quality checks the structure of the decision records present: it cannot know about decisions made and never recorded, and it does not judge how well a record argues its case. Records in a language the section lexicon does not cover are not evaluated.
D24 Comment Value: Comment value is measured as redundancy only: a comment that repeats its code's words is found, but a paraphrase in other words, a vague comment, or one the code contradicts is not, and whether a comment is valuable is not claimed. Comments in other scripts or languages, and outside C#, are not judged.
D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
D27 Navigability: Indirection/navigability is structural — it measures hops to follow a call, not whether that indirection buys real flexibility or just ceremony.
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").
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.
D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a Dockerfile (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
AC1 Text alternatives: Alt-text is detected structurally — the scan sees that an alternative EXISTS, not whether it meaningfully describes the image, and decorative-vs-missing is judged by attribute shape; runtime-injected images and a non-role=img decorative svg are out of scope. This is accessibility readiness, never a WCAG conformance claim.
AC2 Forms & labels: Label association is read from static markup — a label wired up at runtime (JS-set aria-labelledby, framework-injected ids) reads as missing, a present label says nothing about whether its text is correct. A known UI-library field component (e.g. a JSX <TextField>) is now checked conservatively — flagged only when it carries NO label/aria-label/aria-labelledby/id/name — but wrapper/context-labelled libraries (Chakra/Radix FormControl+FormLabel) aren't statically visible (possible false positive) and non-JSX lowercased components are still skipped. A click handler on a plain element is now asked for a name too (it is a control the author declared), but the subtree test that answers it is deliberately generous: any DYNAMIC text expression in the subtree counts as a name, so an icon chosen by a ternary ({cond ? <IconA/> : <IconB/>}) reads as named, and a glyph component from a library the icon-import list does not know still names its parent. A clean result is "no unlabelled control found", not a labelling proof.
AC3 Page structure: Page structure is read from the static markup tree — landmarks, headings and lang injected at runtime aren't seen, heading ORDER is checked structurally (not against the rendered visual hierarchy), and lang/title/main fire only on full documents, never partials, and the data-table check sees header-cell presence (a <th> exists), not whether each header correctly associates with its cells. Static readiness, not conformance.
AC4 Keyboard semantics: Keyboard semantics are inferred from markup attributes — interactivity wired purely in script, focus managed at runtime, and component-level handlers are invisible. A clean result means "no static keyboard-trap shape", not a keyboard-operability proof.
AC5 ARIA correctness: ARIA correctness is checked against the static role/attribute shape — roles/attributes set dynamically aren't seen, a valid role says nothing about whether it matches the element's real behaviour, and required-state checks are suppressed when a JSX spread could supply them. The two-branch toggle check (a control whose state is conveyed only by which of two mutually exclusive branches renders) reads CONDITIONALS THAT ARE ATTRIBUTES — Vue v-if/v-else/v-show and Alpine x-if/x-show — so the same toggle written as a Svelte {#if} block or a JSX ternary is control flow the markup model never projects as a branch and is not seen at all.
AC6 Visual & motion safety: Contrast and motion safety are PARTIAL by construction — literal colours (hex/rgb/hsl/named) in inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS top-level declarations are read (same-rule/same-element colour+background pairs only); computed/runtime/theme colour, external-CDN stylesheets, CSS-in-JS dynamic (${…}) and nested-selector colours, cross-element pairs and image contrast stay out of reach, so a clean result is bounded by what the static CSS itself shows.
AC7 A11y enforcement: Enforcement is scored from in-repo config/CI evidence only — an a11y gate enforced in external tooling with no in-repo trace can't be credited, and a configured linter is presence, not proof the rules actually run or block a merge.
AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
AX9 CQS / query purity: Handlers are found by interface/name convention — a query handler using neither is not seen. Mutation is a resolved write/publish invocation (SaveChanges/repository/bus), so a write hidden behind a hand-rolled wrapper, reflection, or a string-keyed service locator resolves to a non-persistence type and isn't flagged; it detects that a query writes state, not whether the write is a legitimate read-side cache update. Clean means "no resolved write/publish in a query body", not a proof of CQS purity.
DM6 Domain ↔ infrastructure boundary: Infrastructure reached through a hand-rolled wrapper, a domain-named facade, reflection, or a string-keyed service locator resolves to a non-infra type and isn't seen; the body scan is symbol resolution over syntax, not full dataflow. A clean result means "no resolved infra reference in a domain body", not a proof of purity.
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.
497 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was chat.html.chatApp at 412. A further 6 method(s) were over the threshold but excluded as flat dispatchers (a long switch/match over independent cases: many branches, almost no nesting), the largest being ModelSettingsScreenVM.isDiffusionUnsupportedField at 27 — they are counted neither in the figure above nor in this dimension's score. 3 files carry no cyclomatic complexity row at all for this reason — every one of their over-threshold methods was excluded, so the exclusion is disclosed nowhere in the file itself: apps/omlx-mac/Sources/AppView/ViewModels/IntegrationsScreenVM.swift (IntegrationsScreenVM.save at 26), apps/omlx-mac/Sources/AppView/AppView.swift (AppView.screen at 18), apps/omlx-mac/Sources/AppView/AppSection.swift (AppSection.title at 17). They are named here because the per-file figures other dimensions report are taken BEFORE this exclusion, so such a file can show a high maximum complexity elsewhere in this report and nothing here, with nothing to reconcile the two.
+ 488 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 3 bodies over 240 down to 240 or less in Cyclomatic Complexity — start with chat.html.chatApp (cyclomatic 412), routes.update_global_settings (cyclomatic 290), BlockAwarePrefixCache.reconstruct_cache (cyclomatic 252). — 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 3 together lifts Cyclomatic Complexity from 2.1 to about 3.1/10, projected with the scoring formula itself and assuming each lands exactly at 240; a cleaner split scores higher.
Enforce Cyclomatic Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
+ 765 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 91 bodies over 60 down to 60 or less in Cognitive Complexity — start with BlockAwarePrefixCache.reconstruct_cache (cognitive 653), routes.update_global_settings (cognitive 469), chat.html.chatApp (cognitive 459). — 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 91 together lifts Cognitive Complexity from 2.0 to about 4.2/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.
Enforce Cognitive Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D3 · God Classes8.2 / 10Strong✓ Tool-verified
What it measures: Over-large classes that try to do too much ("god classes").
Method: God-class detection by line and method-count thresholds per logical type (partial classes unified), filtered for generated code and registration/contract false positives. Deterministic.
Resolve the 111 FileTooLong finding(s) in God Classes — start with routes.py (2), deepseek_v4_model.py (2), scheduler.py. — One of this dimension's main actionable groups (111 warning-level).
Resolve the 21 MethodTooLong finding(s) in God Classes — start with ModelSettingsScreen.swift (3), ModelSettingsScreenVM.swift (3), ServerScreen.swift (2). — One of this dimension's main actionable groups (21 warning-level).
Resolve the 19 TooManyMethods finding(s) in God Classes — start with vlm.py (2), scheduler.py, engine_pool.py. — One of this dimension's main actionable groups (19 warning-level).
Enforce God Classes in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Copy-pasted code that should be shared instead.
Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), density-scored per KLoC of production code. Deterministic.
507 duplicated block group(s) detected. A further 24 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted.
+ 207 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 28 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with REDACTED (3), AskAIScreen.swift (3), ane_tuning.py (2). — One of this dimension's main actionable groups (28 warning-level).
Resolve the 26 Duplicated block (7 lines × 2) finding(s) in Code Duplication — start with oq.py (3), REDACTED (2), REDACTED (2). — One of this dimension's main actionable groups (26 warning-level).
Resolve the 23 Duplicated block (12 lines × 2) finding(s) in Code Duplication — start with engine_pool.py (2), qwen35_ane_prefill.py (2), ContextBenchScreen.swift (2). — One of this dimension's main actionable groups (23 warning-level).
Enforce Code Duplication in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
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 7 Low cohesion finding(s) in Cohesion (LCOM4) — start with model_registry.py, language.py, REDACTED. — One of this dimension's main actionable groups (7 warning-level).
Enforce Cohesion (LCOM4) in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.
Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D9 · Test Distribution9.9 / 10Exemplary✓ Tool-verified
What it measures: Whether the test suite has a healthy mix of unit / integration / end-to-end tests.
Method: Test projects classified (Unit/Integration/BDD/E2E) from compiled metadata; test methods counted exhaustively across projects with placement-agnostic disk fallback. Deterministic.
13995 test methods: 13675 unit, 231 integration, 0 BDD, 89 e2e. The JavaScript/TypeScript suite contributes 28 `it`/`test` case(s) across 5 test file(s) declaring at least one beside 387 .NET test method(s); its tier split is read from package names and paths only. The Python suite contributes 13580 test function(s) across 519 file(s) declaring at least one — every `def test…` in a file pytest or unittest would collect, which is those frameworks' own definition of a case; a parametrize table counts once, so this is a floor. Its tier split is read from file names and paths only.
✓ On the Gold path — maintain.
Detailed fixes: d9_recommendation.md.
Do you agree with this assessment?
D10 · Test Quality10.0 / 10Exemplary✓ Tool-verified
What it measures: Whether the tests truly assert behaviour rather than just running the code.
Method: Per-test assertions, skips, and mock references analyzed via Roslyn; structured skip-reason tags (BUG:/ENV:) separate documented deferrals from debt. Deterministic.
0 skipped, 0 zero-assertion, no mocking-framework packages referenced (hand-written doubles or no mocking) across 28 tests. Measured on the JavaScript/TypeScript suite only — at least 558 test source file(s) (.py, .swift, .rb) went unread, so its test quality is unmeasured and is not in these counts.
What it measures: Whether dependencies are current, not deprecated, and not bloated. Known vulnerabilities are D30's.
Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (capped-linear for deprecation, prerelease and outdated) per KLoC. Known-vulnerable packages are D30's and are not charged here (rubric-2026.11.2). Exhaustive.
0 outdated, 0 yanked pinned Python distributions. 3 of 30 shipped distributions were graded against pypi.org (0 not published there, 27 declared without an exact pin, which installs the newest release the declaration admits and so cannot be behind one). Only EXACT pins are graded for currency: a floor or a range already installs the newest release it admits, so reporting one would report this repository for being current. Whether a deliberate upper cap has itself gone stale is a different and weaker question, and is not asked. Whether any distribution is UNMAINTAINED is not graded — PyPI publishes no maintenance status, and release age does not stand in for one. Lockfiles are not read (poetry.lock, uv.lock, Pipfile.lock, pdm.lock), so a lock-resolved install is outside this verdict. Known CVEs in this dependency graph are D30's question.
What to do
Enforce Dependency Hygiene in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.
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.
Resolve the 1 Leaked secret finding(s) in Secret Scanning — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Enforce Secret Scanning in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d13_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the licenses of third-party packages are compatible with your policy.
Method: Third-party package licenses resolved from declared package metadata and checked against the configured policy (allow/deny/copyleft). Deterministic; clean = no incompatible license found at metadata depth.
0 of 80 shipped Python distribution(s) use a banned license. Licences were resolved from PyPI over the distributions a consumer installs — this repository's 30 declared runtime requirement(s) closed transitively over each distribution's published `requires_dist` (50 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. 8 of them publish no licence on PyPI this pass can read; that is missing data, not a violation, and none of them is charged. A further 4 direct requirement(s) are installed from a URL or a version-control checkout and publish no licence this pass can read; they are outside this verdict. This repository publishes itself under Apache-2.0, 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.
Top hotspots: omlx/admin/routes.py (119×290=34510); REDACTED (137×159=21783); omlx/scheduler.py (187×99=18513) Repeated repair below the complexity floor: omlx/prefill_transient_tracker.py (12 of 13 changes were fixes); omlx/patches/sdpa256_attention.py (7 of 12 changes were fixes); apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift (5 of 9 changes were fixes)
Resolve the 109 Hotspot finding(s) in Churn × Complexity Hotspots — start with base.py (3), routes.py (2), vlm.py (2). — One of this dimension's main actionable groups (109 warning-level).
Resolve the 23 Repeated repair finding(s) in Churn × Complexity Hotspots — start with prefill_transient_tracker.py, sdpa256_attention.py, ServerScreen.swift. — One of this dimension's main actionable groups (23 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 Factor8.9 / 10Strong✓ Tool-verified
What it measures: Whether knowledge is concentrated in too few people (the "bus factor").
Method: Living knowledge per author via time-decayed commit attribution (6-month half-life, focus weighting) across largest source files. Deterministic, avoids blame's mechanical-refactor false positives.
61 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is omlx/patches/mlx_vlm_mtp/inkling_vlm_runtime.py. Counted over 541 of the 631 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 · ×2
Further sole-owners (lower concentration)
What to do
Resolve the 2 Off-boarding risk finding(s) in Bus Factor. — One of this dimension's main actionable groups (2 recommendation-level).
Resolve the 1 Further sole-owners (lower concentration) finding(s) in Bus Factor. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d16_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
0 deducted task-comment markers across 326990 LoC (0.0/KLoC) → score 10.0. Task comments only: this repository's language is read without a compiler, so D17's suppression, dead-code and commented-out-code arms did not run and this score counts fewer marker kinds than a .NET repository's would.
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 1 documentation facets pass in full. 24 document(s) read across 1 unit(s).
✓ On the Gold path — maintain.
Detailed fixes: d19_recommendation.md.
Do you agree with this assessment?
D20 · ADR Quality0.0 / 10Critical✓ Tool-verified
What it measures: Whether architecture decisions are recorded well (context, decision, consequences).
Method: Every ADR read by its section structure: nine located rules (a missing Decision, Context or Consequences section, a stale status, two records deciding the same question, a dangling supersede link, a number-only title, a single option, no named cost, no status where the log uses one, no enforcement field where the log adopted one), each a fixed deduction from 10; the score is the mean over evaluated records. Deterministic, no model. Advisory.
What it measures: Whether comments are worth it — explaining WHY (valuable) rather than WHAT (redundant).
Method: Every inline C# comment compared word by word with the identifiers, literals and constructs of the code it annotates (taken from the syntax); a comment whose words that code already contains is redundant, as are closing-brace labels and generator template text. Comments giving a reason or a reference are kept; other scripts and languages are not judged. Deterministic, exhaustive, advisory.
2 of 2 build units (Python, Xcode) flagged as possibly oversized/incoherent.
Projects may be oversized for their cohesion
What to do
Resolve the 1 Projects may be oversized for their cohesion finding(s) in Project Cohesion. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d26_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
83 % of calls cross a namespace and 0 % go through an interface, but 99 % of collaborators are co-located — so a call's collaborators sit together and tracing stays easy. Baseline: small — navigation cost is tolerated.
What it measures: 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).
54 finding(s): 0 critical, 7 high, 35 medium, 12 low. semgrep hit a parse error in 23 file(s) — `apps/omlx-mac/Tests/oMLXTests/MenubarControllerPortTests.swift` (line 189, line 191, line 209, …), `apps/omlx-mac/Tests/oMLXTests/MenubarMetricTests.swift` (line 55, line 65, line 73, …), `apps/omlx-web/omlx_web/static/js/cluster_v2.js`, `REDACTED`, `apps/omlx-web/omlx_web/static/js/gridstack-all.js`, … (+18 more) — so no absence of findings in the named regions is evidence of anything; rows reported elsewhere in those files are real. Fix the syntax error (or exclude the file deliberately) and re-scan to cover them. Separately, one or more rules could not re-parse an embedded snippet in 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
REDACTED
+ 14 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 2 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED, REDACTED. — One of this dimension's main actionable groups (2 issue-level).
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).
Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
6 of 541 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is apps/omlx-mac/Sources/AppView/ViewModels/AccuracyBenchScreenVM.swift. Counted over 541 of the 631 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
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 Boundary-crossing change coupling finding(s) in Change Coupling — start with PerformanceScreen.swift (2). — One of this dimension's main actionable groups (2 issue-level).
Resolve the 4 Change coupling finding(s) in Change Coupling — start with qwen35_moe_vlm_model.py, PerformanceScreen.swift, qwen35_model.py. — One of this dimension's main actionable groups (4 warning-level).
Resolve the 1 Change-coupling hub finding(s) in Change Coupling — start with REDACTED. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d35_recommendation.md · top locations in Appendix A, every location in findings.md.
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 the repository publishes a coordinated-vulnerability-disclosure policy (SECURITY.md or security.txt) with a reporting contact, so finders know how to report a vulnerability. Presence of a policy file with a contact, not whether the policy is adequate or honoured.
Method: Vulnerability-disclosure policy read deterministically from the repo: a SECURITY.md (root/.github/docs) or .well-known/security.txt / security.txt, regex-checked for a reporting contact (email / URL / mailto). Present + contact → 10; present without a contact → 4; NotApplicable when no policy file exists (it may live off-repo). Detects the policy file's presence + contact, not its adequacy.
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 30 dependency declaration(s). This dimension reads what the repository says about ITSELF — a pinned target framework, a version file, a capped requires-python, a Rust toolchain pin, a framework major a constraint cannot move off. A FLOOR is deliberately never charged: `requires-python = ">=3.8"` states what the package SUPPORTS, not what it runs on, and a well-maintained library declares exactly that while running its own CI on a current release. The end-of-life facts are FROZEN and dated, so this dimension needs no network and answers identically inside a closed scan fence; as the table ages it loses recall and never precision, because a statement about support that ended in the past cannot become false. The OS layer of a container image is D31's question and the toolchain a CI workflow installs is D29's; this row is neither.
✓ On the Gold path — maintain.
Detailed fixes: d44_recommendation.md.
Do you agree with this assessment?
Frontend & cross-cutting dimensions
R = React/JS · M = Maturity · P = Readiness.
AC1 · Text alternatives10.0 / 10Exemplary○ Nothing flagged
Other · Accessibility — Whether non-text content carries a text alternative — img/area/input[type=image] have alt, a meaningful svg has a title or aria-label, video has a captions track, and object/embed/canvas have a name or fallback content. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: every img/area/input[type=image] checked for alt, svg[role=img] for a title/aria-label, video for a captions <track>. Components skipped, spreads suppressed. Deterministic, hard fact per element.
Coverage: Population: image/media elements — img, area, input[type=image], svg, video, object, embed, canvas — across the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and dynamic-attribute elements are skipped. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is NOT read by any producer, so it contributes no element to this population; where such a frontend is present the card discloses it as an analyzer gap rather than scoring around it.
Do you agree with this assessment?
AC2 · Forms & labels3.1 / 10Weak✓ Tool-verified
Other · Accessibility — Whether form controls have a programmatic label (an associated label, aria-label or aria-labelledby), buttons have text, links have an accessible name, a click handler on a plain element names the control it declares, fieldsets have a non-empty legend, known UI-library field components carry a label prop, and a placeholder isn't used as the only label. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: inputs/selects/textareas checked for an associated label[for]/wrapping label/aria-label/aria-labelledby (per document), buttons for accessible text, fieldsets for a legend; placeholder-only labelling flagged. Deterministic, hard fact per control.
Coverage: Population: form controls, buttons, links, fieldsets and known UI-library field components in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and spread/dynamic-attribute elements are skipped, so a control whose label arrives through a spread or a runtime expression is deliberately not judged. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label. (×7) — apps/omlx-web/omlx_web/templates/chat.html:1220, apps/omlx-web/omlx_web/templates/chat.html:1284, apps/omlx-web/omlx_web/templates/chat.html:2051, …
A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one). (×8) — apps/omlx-web/omlx_web/templates/chat.html:1389, apps/omlx-web/omlx_web/templates/chat.html:2225, apps/omlx-web/omlx_web/templates/chat.html:2303, …
This <div> carries a click handler, which makes it a control, but it has no text, aria-label or labelled child (the icon-only case), so assistive tech has no name to announce for it. Note that switching it to <button type="button"> — the right fix for its keyboard operability — does not give it a name either: an icon-only button still needs one. Add visible text or an aria-label. (×3) — apps/omlx-web/omlx_web/templates/chat.html:1924, apps/omlx-web/omlx_web/templates/chat.html:2711, apps/omlx-web/omlx_web/templates/dashboard.html:66
This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id. (×16) — apps/omlx-web/omlx_web/templates/chat.html:2127, apps/omlx-web/omlx_web/templates/chat.html:2492, apps/omlx-web/omlx_web/templates/chat.html:2503, …
This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it. (×6) — apps/omlx-web/omlx_web/templates/chat.html:2135, apps/omlx-web/omlx_web/templates/chat.html:2566, apps/omlx-web/omlx_web/templates/chat.html:2575, …
What to do
Give every control a programmatic label (a <label for> / wrapping <label> / aria-label) and every button text — a placeholder is not a label.
Do you agree with this assessment?
AC3 · Page structure6.8 / 10Strong✓ Tool-verified
Other · Accessibility — Whether pages declare a language (well-formed BCP-47) and a non-empty title, expose exactly one main landmark and a sane heading order with non-empty headings, keep zoom enabled, title their iframes, give data tables header cells, and avoid meta-refresh. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: html lang, document <title>, a main landmark and heading order on full documents only, plus zoom-disabling viewports, untitled iframes and meta-refresh anywhere. Deterministic, per structural checkpoint.
Coverage: Population: the PARSED MARKUP documents (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx). The page-level checks — lang, title, single main landmark — fire ONCE PER FULL DOCUMENT (an <html> root) and never on a partial or component fragment, so a repo of fragments is assessed only on the per-element checks (heading order, table headers, iframe titles, meta-refresh, zoom). Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>. — REDACTED:2
Skipping heading levels breaks the document outline assistive tech relies on. Don't jump levels — increase by at most one. — apps/omlx-web/omlx_web/templates/chat.html:2719
A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope). — apps/omlx-web/omlx_web/templates/dashboard/_bench.html:322
What to do
Declare <html lang>, a document <title> and a <main> landmark, keep headings in order, leave zoom enabled, title iframes and drop meta-refresh.
Other · Accessibility — Whether interactive behaviour is keyboard-reachable — no click handler on a non-interactive element lacking a role, tabindex and key handler, no element the repo's own CSS styles `cursor: pointer` without giving it any of the three, no unfocusable element whose only binding is a mouse enter/leave pair or a double-click, no positive tabindex, no href-less anchor, no placeholder-href (#/javascript) link acting as a button. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: click handlers on non-interactive elements lacking role+tabindex+key handler, positive tabindex values, and href-less anchors. Components skipped, spreads suppressed. Deterministic, hard fact per element.
Coverage: Population: elements that pose a keyboard-semantics question, in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx) — a non-natively-interactive element carrying a click handler, a double-click or hover enter/leave binding, a pointer-only gesture on a tabindex="0" element, or `cursor: pointer` from the repo's own CSS; an href-less or placeholder-href (#, javascript:) anchor; and any element with a positive tabindex. Natively interactive elements used correctly (<button>, <a href>, form controls) are NOT in the population — there is nothing to judge — so a page of nothing but correct controls gives AC4 nothing to measure. Keyboard reachability is judged from the markup, never from a rendered page. ★ An interactive element declared in a tagged-template (html`…`) or hyperscript frontend is NOT in this population — no producer reads either — so an empty population is reported as an analyzer gap, never as "this repository has no interactive elements".
A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler. (×22) — apps/omlx-web/omlx_web/templates/chat.html:1924, apps/omlx-web/omlx_web/templates/chat.html:2475, apps/omlx-web/omlx_web/templates/chat.html:2711, …
This <div> binds mouse-enter and mouse-leave and nothing else — no click, no key handler, no focus handler, and no tabindex="0", so it cannot even take focus. A keyboard user cannot hover, so whatever the pair reveals or highlights is reachable with a mouse only. Bind the same state to focus/blur as well, and add tabindex="0"="0" so the element can receive that focus. — apps/omlx-web/omlx_web/templates/chat.html:2326
This <div role="dialog"> is a modal dialog, but focus is moved into it, but nothing keeps it there: Tab walks out to the page behind, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close. — apps/omlx-web/omlx_web/templates/chat.html:2366
This <i> binds mouse-enter and mouse-leave and nothing else — no click, no key handler, no focus handler, and no tabindex="0", so it cannot even take focus. A keyboard user cannot hover, so whatever the pair reveals or highlights is reachable with a mouse only. Bind the same state to focus/blur as well, and add tabindex="0"="0" so the element can receive that focus. — apps/omlx-web/omlx_web/templates/dashboard/_bench.html:6
This <span> binds mouse-enter and mouse-leave and nothing else — no click, no key handler, no focus handler, and no tabindex="0", so it cannot even take focus. A keyboard user cannot hover, so whatever the pair reveals or highlights is reachable with a mouse only. Bind the same state to focus/blur as well, and add tabindex="0"="0" so the element can receive that focus. — apps/omlx-web/omlx_web/templates/dashboard/_models.html:1400
What to do
Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.
Other · Accessibility — Whether ARIA is used correctly — valid non-abstract roles, the ARIA state a role requires, valid (non-misspelled) aria-* attribute names, in-enum values for token-typed aria-* attributes, and no aria-hidden on (or wrapping) a focusable element. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: role values checked against the WAI-ARIA role set (abstract/invalid flagged), required ARIA state for a role, and aria-hidden on a focusable element. Deterministic, role/attribute level.
Coverage: Population: elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx) that carry a role or an aria-* attribute; roles and token values are checked against the ARIA enums exhaustively within that set. An expression-valued (dynamic) role or aria-* value is skipped rather than guessed, and markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
Other · Accessibility — Whether focus outlines aren't removed without a replacement, motion respects prefers-reduced-motion, and literal CSS colour pairs meet contrast — PARTIAL: inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS literals are read (hex/rgb/hsl/named), never computed/runtime/external-CDN colour. Static markup readiness, not a WCAG conformance claim.
Method: Static markup/CSS scan: inline outline:none/0, literal inline colour/background contrast against the 4.5:1 AA floor, and <style>-block animation without a prefers-reduced-motion guard. Deterministic but PARTIAL — only inline styles and in-repo CSS literals are visible.
Coverage: Population: styled elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx), plus in-repo <style> blocks, in-repo .css files and CSS-in-JS literals. Colour contrast is computed from LITERAL colour pairs only (hex/rgb/hsl/named, including var() tokens and Tailwind neutral utilities) — computed, runtime-themed and external-CDN colour is never resolved, so this is a partial read of contrast by construction. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
`.message-fade-in` moves (`animation: fadeIn 0.3s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — apps/omlx-web/omlx_web/templates/chat.html:80
`.svg-allow-switch-knob` moves (`transition: transform 0.2s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — apps/omlx-web/omlx_web/templates/chat.html:532
`.thinking-toggle` moves (`transition: transform 0.2s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — apps/omlx-web/omlx_web/templates/chat.html:657
`.composer-switch::after` moves (`transition: transform 0.15s`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — apps/omlx-web/omlx_web/templates/chat.html:863
`.reasoning-slider-fill` moves (`transition: width 0.15s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — apps/omlx-web/omlx_web/templates/chat.html:897
`.inline-edit-textarea` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. — apps/omlx-web/omlx_web/templates/chat.html:603
`.reasoning-slider input[type="range"]:focus` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. — apps/omlx-web/omlx_web/templates/chat.html:929
<input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2). (×7) — apps/omlx-web/omlx_web/templates/chat.html:1220, apps/omlx-web/omlx_web/templates/chat.html:1284, apps/omlx-web/omlx_web/templates/chat.html:2566, …
<select> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2). (×2) — apps/omlx-web/omlx_web/templates/chat.html:2135, apps/omlx-web/omlx_web/templates/chat.html:2727
<textarea> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2). (×4) — apps/omlx-web/omlx_web/templates/chat.html:2494, apps/omlx-web/omlx_web/templates/dashboard/_bench.html:381, apps/omlx-web/omlx_web/templates/dashboard/_bench_accuracy.html:537, …
This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade. (×5) — apps/omlx-web/omlx_web/templates/dashboard.html:29, apps/omlx-web/omlx_web/templates/dashboard/_bench.html:57, apps/omlx-web/omlx_web/templates/dashboard/_bench_accuracy.html:332, …
<svg> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:. (×5) — apps/omlx-web/omlx_web/templates/dashboard.html:0, apps/omlx-web/omlx_web/templates/dashboard/_bench_accuracy.html:0, apps/omlx-web/omlx_web/templates/dashboard/_cluster_v2.html:0, …
<div> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:. (×6) — apps/omlx-web/omlx_web/templates/dashboard/_bench.html:259, apps/omlx-web/omlx_web/templates/dashboard/_bench.html:400, apps/omlx-web/omlx_web/templates/dashboard/_models.html:494, …
<span> moves — its `animate-ping` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:. — apps/omlx-web/omlx_web/templates/dashboard/_cluster_v2.html:227
<button> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2). — apps/omlx-web/omlx_web/templates/dashboard/_logs.html:64
<i> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:. (×2) — apps/omlx-web/omlx_web/templates/dashboard/_settings.html:1262, apps/omlx-web/omlx_web/templates/dashboard/_settings.html:1279
What to do
Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1.
Do you agree with this assessment?
AC7 · A11y enforcement4.0 / 10Weak✓ Tool-verified
Other · Accessibility — Whether accessibility is ENFORCED in the toolchain — an accessibility checker configured over the markup (an a11y lint rule set, e.g. eslint-plugin-jsx-a11y or vuejs-accessibility where the project lints JavaScript) and an automated accessibility assertion wired into tests or CI (axe/pa11y/Lighthouse or an equivalent) — on the Documented→Verified→Prevented ladder.
Method: Repo config/CI scan: an accessibility checker configured over the markup (an a11y lint rule set such as eslint-plugin-jsx-a11y / vuejs-accessibility where JavaScript is linted) and an automated accessibility assertion in tests or CI (axe/pa11y/Lighthouse or equivalent), graded on the Documented→Verified→Prevented rungs. Deterministic, presence/rung detection.
Coverage: Population: the repository's own tooling configuration — lint config, test and CI files — NOT the markup. It is read for a configured accessibility checker and an automated accessibility assertion (axe/pa11y/Lighthouse, or a native-toolkit equivalent), and it credits an INVOCATION, never a mention: a licence filename, an import comment or a doc reference earns no rung. Enforcement configured entirely outside the repository leaves no evidence here and cannot be credited.
No accessibility enforcement found — no accessibility linting at author time and no automated accessibility check in tests or CI. Add your UI toolkit's own accessibility assertion to the test suite (Flutter `meetsGuideline`, Espresso `AccessibilityChecks`, XCTest `performAccessibilityAudit`), then gate that test in the pipeline. What was searched, so you can tell an absence from a miss: the 26 markup file(s) this pass actually assessed, the linter configuration checked in beside them, and this repository's test and CI files — matched by name against the accessibility checkers this dimension carries. An audit run outside the repository, a hosted scanner, or a check whose name is not one of those, is not seen here.
What to do
Enforce accessibility in the toolchain your project already uses: assert accessibility in your UI test suite with your toolkit's own matcher (Flutter `meetsGuideline`, Espresso `AccessibilityChecks`, XCTest `performAccessibilityAudit`), then gate that test in CI so a regression blocks the merge.
Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.
Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.
Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.
What to do
The domain core is a small share of production code, but most of the rest matched no layer vocabulary at all — so this is not yet an anemic-domain finding. The namespace/path convention could not place that code, which makes the composition above a statement about the naming, not about the design. Name the layers (or check that the repository's conventions differ from the ones this check knows) before reading a thin domain into it.
Other · Architecture — Whether singleton services avoid mutable shared instance state that concurrent callers would race on.
Method: Roslyn scan: singleton field mutations unguarded by lock or Interlocked, per type; syntax-based guard detection. Deterministic, traceable per field.
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.
Other · Architecture — Whether read (query) handlers stay side-effect-free — a query that writes persistent state or raises events breaks CQS and makes reads unsafe to retry, cache, or route to a read replica.
Method: Roslyn scan: CQRS handlers classified query-vs-command by interface (IQueryHandler/ICommandHandler/IRequestHandler<TQuery,TResult>) and name convention (*Query/Get*/Find* vs *Command); each query handler's body checked for persistent-state writes (SaveChanges/repository Add-Update) or event publishes by resolved invocation. Deterministic, type-level, exhaustive over the detected handlers.
Coverage: Population: CQRS handlers identified by IQueryHandler/ICommandHandler/IRequestHandler interface + *Query/Get*/Find*/*Command NAME convention; query purity then checked exhaustively within that set — a query handler using neither convention is invisible, and mutation is a resolved persistence/publish CALL, not full dataflow.
Other · Domain Modelling — Whether the domain layer stays free of infrastructure dependencies — a domain aggregate fused to a persistence ORM (Django/SQLAlchemy) on its own declaration (active-record) couples the domain to infrastructure. The clean-architecture dependency rule.
Method: Roslyn (DDD-gated): domain-layer types scanned for infrastructure usage in member SIGNATURES and inside method/accessor BODIES — resolved calls and object-creations into EF/Marten/HTTP/Mongo/Redis/message-bus types (not just a namespace allowlist). Deterministic, symbol-resolved, exhaustive over domain-layer bodies, DDD-native.
Coverage: Domain layer identified by NAMESPACE heuristic; infrastructure then resolved by symbol in member SIGNATURES and method/accessor BODIES — rename the layer and the check evaporates.
Maturity · Maturity — Whether the repo and its projects have a README, and whether it's substantive and current.
Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.
Maturity · Maturity — Whether key decisions (ADRs) and the high-level shape (C4/diagrams) are written down.
Method: Filesystem scan: ADR folder/naming conventions or content, plus Mermaid/PlantUML/C4/architecture.md discovery. Exhaustive, deterministic.
No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
What to do
Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
Maturity · Maturity — Whether the repo is organised deliberately — src/test separation and consistent project naming.
Method: Filesystem scan: src/test folder separation and namespace-prefix consistency (majority RootNamespace agreement). Exhaustive across projects, deterministic.
Production code isn't grouped under a src/ folder — it's spread across several top-level directories, so there's no one place that says 'this is the product'.
What to do
Group production code under src/ (or split deliberately, e.g. backend/ + frontend/) so production and tooling code aren't mixed at the root.
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 · Observability8.0 / 10Strong✓ Tool-verified
Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.
Readiness · Readiness — Whether SAST, secret/dependency scanning and performance benchmarking are wired in (presence, not runtime).
Method: Filesystem scan: SAST configuration, dependency-update automation, secret scanning, and a benchmark harness or benchmark step — in this repository's own ecosystem. Exhaustive, deterministic.
No static application security testing detected. For this repository's stack, add bandit, `semgrep --config=p/python`, or CodeQL's python pack as a CI step. What was searched, so you can tell an absence from a miss: the 14116 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:6
What to do
Add a SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — so a security regression fails the build instead of landing.
Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
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.
The release is automated and no gate that pauses it for a human is DECLARED IN THIS REPOSITORY'S PIPELINE FILES. What was read: every file under `.github/workflows/`, `.forgejo/workflows/`, `.gitea/workflows/`, `.azuredevops/` and `.azure-pipelines/`, plus `.gitlab-ci*` and `azure-pipelines*` — with comment text stripped, so documenting a gate is not declaring one. What would have counted: GitLab's `when: manual`, CircleCI's `type: approval`, an Azure `ManualValidation@` task or an `approvals:` block, a Jenkins `input` step, a `uses:` step naming an approval action, an `environment:` paired with `reviewers` / `required_reviewers` / `protection` / `wait-timer` / `deployment_branch_policy`, a draft-release step, a `workflow_dispatch` promotion, or a release-event gate. ★ What this cannot see, because none of it is a file: a GitHub environment whose required reviewers are configured in repo SETTINGS, a branch protection rule, or an organisation deployment policy — all of them real, enforced gates that live outside the repository. If yours is one of those, this row is wrong and nothing in the tree could have told us. Otherwise: whatever the release trigger points at is published to users unreviewed, so a mistagged or unverified commit ships and the only remedy is a follow-up release.
What to do
Nothing pauses a release for a human: publish as a draft release (or gate the release job on a protected tag/manual dispatch) so a bad build can be stopped before users can download it.
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.
Readiness · Readiness — Whether outbound HTTP calls are wrapped in resilience (retry/timeout/circuit-breaker) so a failing dependency doesn't cascade.
Method: Source scan: outbound HTTP clients and what bounds them — resilience handlers (Polly, AddStandardResilienceHandler) on .NET; on Go, the JVM, Python, JavaScript/TypeScript, Ruby, PHP, Rust, Elixir, Swift, Dart and Erlang, a timeout, deadline, retry or breaker beside each call, or a process-wide client default (a framework-wide deadline such as Drupal core's, Laravel's or actix's awc counts). Exhaustive, deterministic.
`urllib.request.urlopen(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout. (×2) — REDACTED:40, REDACTED:127
`requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout. (×4) — REDACTED:452, REDACTED:865, omlx/scheduler.py:3841, …
What to do
Pass `timeout=` on every `requests`/`httpx` call (requests has no default and will wait forever), mount an `HTTPAdapter(max_retries=Retry(...))` on shared sessions, and wrap calls to flaky dependencies in `tenacity` retries or a `pybreaker` circuit breaker.
Readiness · Performance — Whether asynchronous code stays responsive — it avoids sync-over-async blocking (a .NET .Wait()/.GetAwaiter().GetResult(), a time.sleep or blocking HTTP call inside a Python coroutine, a *Sync call inside an async JavaScript function, block_on inside a Rust async fn, runBlocking inside a Kotlin suspend function, block() inside a Reactor publisher) that stalls a thread or event loop and risks deadlock, and, where the code is a reusable library on .NET, awaits with ConfigureAwait(false) so it never captures and stalls its caller's context.
Method: Production-source scan: sync-over-async blocking counted everywhere — .Wait()/.GetAwaiter().GetResult() in .NET; off .NET, read from each language's code model, a blocking call inside an async function (Python, TS/JS, Rust, Kotlin, Swift, Dart) or inside a Java method returning a Reactor Mono/Flux or a Scala method returning a Future or effect — and, for a .NET library with ≥5 awaits, the share of awaits using ConfigureAwait(false). Deterministic, syntax/text detection.
Do you agree with this assessment?
R1 · Type Safety0.0 / 10Critical✓ Tool-verified
React / JS · Code Health — How much of the frontend is typed TypeScript vs untyped JavaScript.
Method: Frontend file inventory: the share of typed TypeScript vs untyped JavaScript across the source tree. Deterministic, exhaustive over frontend files.
0 typed · 17 plain JS — the untyped files are apps/omlx-web/omlx_web/static/js/cluster_v2.js, apps/omlx-web/omlx_web/static/js/count_format.js, apps/omlx-web/omlx_web/static/js/custom_theme.js, REDACTED, apps/omlx-web/omlx_web/static/js/dashboard_layout.js, REDACTED (+11 more).
What to do
Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up.
React / JS · Code Health — Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm over JS/TS tokens, D-386): a block is reported only where its copies still agree on most of their own identifiers and literals, or were renamed as they were pasted but kept most of their constants, and where the copies carry enough code to stand on their own or the copied extent reaches 30 lines — so a re-implementation sharing neither names nor values, and a small pasted declaration, are both found and deliberately not reported, and a clean R10 is not a claim that nothing was copied.
Method: Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm run over JS/TS tokens). Masking finds the candidates; a block is reported when its copies still agree on most of their own identifiers and literals, or when a renamed copy still agrees on most of its constants, AND the copies carry enough code to stand on their own — or when the copied extent reaches 30 lines. So a re-implementation sharing neither names nor values, and a small pasted declaration, are deliberately not counted. Deterministic.
REDACTED:7969 · REDACTED:8267 — the two spans are one implementation copied and then locally edited — 607 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — REDACTED:7969
REDACTED:7733 · REDACTED:9096 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:7733
REDACTED:5407 · REDACTED:5561 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:5407
REDACTED:5505 · REDACTED:5608 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — REDACTED:5505
REDACTED:7855 · REDACTED:9146 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — REDACTED:7855
REDACTED:7226 · REDACTED:7331 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:7226
REDACTED:8410 · REDACTED:8844 · REDACTED:9222 · REDACTED:9287 · +1 more site(s) not listed — all 5 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:8410
REDACTED:8784 · REDACTED:9250 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:8784
apps/omlx-web/omlx_web/static/js/cluster_v2.js:3427 · apps/omlx-web/omlx_web/static/js/cluster_v2.js:3740 · apps/omlx-web/omlx_web/static/js/cluster_v2.js:3764 — all 3 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — apps/omlx-web/omlx_web/static/js/cluster_v2.js:3427
REDACTED:7916 · REDACTED:8066 · REDACTED:8359 · REDACTED:9186 — all 4 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:7916
apps/omlx-web/omlx_web/static/js/cluster_v2.js:3736 · apps/omlx-web/omlx_web/static/js/cluster_v2.js:3760 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — apps/omlx-web/omlx_web/static/js/cluster_v2.js:3736
REDACTED:1669 · REDACTED:1692 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:1669
REDACTED:1788 · REDACTED:3495 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:1788
REDACTED:6913 · REDACTED:7150 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:6913
apps/omlx-web/omlx_web/static/js/cluster_v2.js:667 · apps/omlx-web/omlx_web/static/js/cluster_v2.js:682 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — apps/omlx-web/omlx_web/static/js/cluster_v2.js:667
REDACTED:1900 · REDACTED:1913 · REDACTED:7775 — all 3 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:1900
REDACTED:2486 · REDACTED:2654 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:2486
REDACTED:3779 · REDACTED:3950 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — REDACTED:3779
REDACTED:4254 · REDACTED:4697 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:4254
REDACTED:6242 · REDACTED:8048 · REDACTED:8341 — all 3 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:6242
REDACTED:7710 · REDACTED:9077 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — REDACTED:7710
REDACTED:1605 · REDACTED:1908 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — REDACTED:1605
REDACTED:2553 · REDACTED:2699 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:2553
REDACTED:6496 · REDACTED:6616 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — REDACTED:6496
REDACTED:8231 · REDACTED:8290 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:8231
REDACTED:2458 · REDACTED:2629 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — REDACTED:2458
REDACTED:5642 · REDACTED:5925 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:5642
REDACTED:2841 · REDACTED:2865 · REDACTED:2903 · REDACTED:2977 — all 4 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:2841
REDACTED:5899 · REDACTED:6511 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:5899
REDACTED:7195 · REDACTED:7317 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:7195
REDACTED:1573 · REDACTED:6875 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:1573
REDACTED:4547 · REDACTED:5714 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:4547
REDACTED:5393 · REDACTED:6209 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:5393
REDACTED:8491 · REDACTED:9346 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — REDACTED:8491
REDACTED:2475 · REDACTED:2601 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:2475
REDACTED:3417 · REDACTED:3426 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:3417
REDACTED:6515 · REDACTED:7004 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — REDACTED:6515
REDACTED:2529 · REDACTED:7736 · REDACTED:8493 · REDACTED:8843 · +2 more site(s) not listed — all 6 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:2529
REDACTED:5014 · REDACTED:5078 · REDACTED:8715 — all 3 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:5014
REDACTED:5124 · REDACTED:5136 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:5124
What to do
Act on each finding's own remediation rather than one rule: the move depends on what recurs. Where the copies are executable blocks, give the shared part one home and call it from each site; where they are declarations, a listing, a specialisation already delegating to its base, or one shape repeated per entity, there is no call site and the move is a shared type, a generated set or a factory — sometimes there is nothing to extract.
React / JS · Code Health — Per-function cyclomatic/cognitive complexity from the token-level function scanner (D-386) — real branching, not a regex heuristic.
Method: Per-function cyclomatic/cognitive complexity from a token-level function scanner (real branching, not a regex heuristic), computed over every frontend function. Deterministic.
buildModelSettingsPayload has cyclomatic complexity 91 and cognitive complexity 108; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:3490
buildModelSettingsState has cyclomatic complexity 87 and cognitive complexity 84; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:2155
formValuesForProfile has cyclomatic complexity 52 and cognitive complexity 95; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:1730
accDownloadResult has cyclomatic complexity 36 and cognitive complexity 56; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:6531
checkRows has cyclomatic complexity 33 and cognitive complexity 40; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — apps/omlx-web/omlx_web/static/js/cluster_v2.js:2073
saveGlobalSettings has cyclomatic complexity 33 and cognitive complexity 38; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:1402
(anonymous) has cyclomatic complexity 31 and cognitive complexity 32; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:7192
prefillHelperStatusText has cyclomatic complexity 28 and cognitive complexity 21; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:3284
applyANETuningRecommendation has cyclomatic complexity 26 and cognitive complexity 34; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:2919
runPlan has cyclomatic complexity 25 and cognitive complexity 24; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — apps/omlx-web/omlx_web/static/js/cluster_v2.js:2819
wizardState has cyclomatic complexity 24 and cognitive complexity 23; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — apps/omlx-web/omlx_web/static/js/cluster_v2.js:1069
validateQwenAneSettings has cyclomatic complexity 22 and cognitive complexity 30; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:3413
openModelSettings has cyclomatic complexity 22 and cognitive complexity 29; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:3011
(anonymous) has cyclomatic complexity 21 and cognitive complexity 29; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — apps/omlx-web/omlx_web/static/js/cluster_v2.js:1903
aggregateLogRows has cyclomatic complexity 20 and cognitive complexity 24; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:71
defaults has cyclomatic complexity 19 and cognitive complexity 40; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — apps/omlx-web/omlx_web/static/js/custom_theme.js:181
handleMainTabChange has cyclomatic complexity 19 and cognitive complexity 30; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:890
accBuildText has cyclomatic complexity 19 and cognitive complexity 30; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:6410
submitPairApproval has cyclomatic complexity 19 and cognitive complexity 28; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — apps/omlx-web/omlx_web/static/js/cluster_v2.js:1431
saveModelSettings has cyclomatic complexity 19 and cognitive complexity 27; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:3729
What to do
Break down the listed branch-heavy functions; aim P95 cyclomatic ≤ 5.
Do you agree with this assessment?
R3 · Large Files0.0 / 10Critical✓ Tool-verified
React / JS · Code Health — How many source files exceed the large-file threshold.
Method: Components/modules exceeding the large-file threshold, counted exhaustively across the frontend source tree. Deterministic.
REDACTED has 8688 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
apps/omlx-web/omlx_web/static/js/cluster_v2.js has 3983 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — apps/omlx-web/omlx_web/static/js/cluster_v2.js:1
What to do
Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.
Do you agree with this assessment?
R4 · Test Coverage3.8 / 10Weak✓ Tool-verified
React / JS · Readiness — Static test reachability (D-386): the share of production files reachable from any test via the import graph — measured without running anything.
Method: Static test reachability: the share of production files reachable from any test via the import graph — measured without running anything. Deterministic.
No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one. (×5) — apps/omlx-web/omlx_web/static/js/cluster_v2.js:1, apps/omlx-web/omlx_web/static/js/custom_theme.js:1, REDACTED:1, …
What to do
Add tests that import the unreached modules (directly or through their public entry).
Do you agree with this assessment?
R7 · Dead Code10.0 / 10Exemplary✓ Tool-verified
React / JS · Code Health — Files unreachable from every application/tooling/test entry point, and exports nothing imports (module-graph reachability, D-386).
Method: Dead code: files unreachable from every application/tooling/test entry point plus exports nothing imports, via module-graph reachability. Deterministic, exhaustive over the import graph.
React / JS · Architecture — Import cycles in the module graph (D-386) — files that can only be understood and changed together.
Method: Import cycles in the module graph, detected exhaustively over JS/TS imports (the same cycle detection as the .NET coupling dimension). Deterministic.
Other · Code Health — Whether the code avoids sync-over-async (deadlock-prone blocking on tasks) and async void.
Method: Roslyn syntax scan: async methods scanned for .Wait()/.GetAwaiter().GetResult() and async-void outside event handlers. Deterministic, hard fact per invocation.
The task this creates is not kept anywhere. The event loop holds only a weak reference to its tasks, so a task nobody references can be garbage-collected before it finishes (Python's documentation for `asyncio.create_task`: save a reference to the result); and nothing ever awaits it, so an exception it raises is never handled — it surfaces, if at all, as "Task exception was never retrieved" in a log. Keep the task: `await` it, gather it, start it in an `asyncio.TaskGroup` (`async with asyncio.TaskGroup() as tg: tg.create_task(…)`), or, for genuine fire-and-forget, add it to a set and `task.add_done_callback(tasks.discard)` with a callback that also reads its exception. — omlx/engine_core.py:1513
Other · Code Health — Whether any branch is dead by construction — a switch arm whose label can never equal a case-normalised subject, or an `else if` whose predicate the arm above has already swallowed.
Method: Roslyn syntax + semantics: switch labels compared against the subject's own case normaliser, and if/else-if chains checked for a literal an earlier arm's containment test already swallows. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X13 · Undrained process stream10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a child process that has BOTH standard streams redirected drains both — reading one to the end while the other is never read deadlocks once the child fills the unread pipe.
Method: Roslyn syntax + semantics: ProcessStartInfo launches with both streams redirected, checked for a drain of each stream across the enclosing type. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `spawn` imported from `child_process` whose stdout and stderr are both pipes (no options, no `stdio`, or `stdio` of `'pipe'`), bound to a local that never leaves its scope, where exactly one of the two streams is read, the other never, and the child’s `close`/`exit` (or the read stream’s end) is awaited; a shell redirect in the call’s arguments or a `kill` of the child suppresses it. The same rule reads Python’s `subprocess.Popen`, Dart’s `Process.start`, Ruby’s `Open3.popen3`, and Scala’s JDK process starts (`new ProcessBuilder(…).start()` with no `redirectErrorStream`/`redirectError`/`redirectOutput`/`inheritIO`, `Runtime.getRuntime.exec`) where one of `getInputStream`/`getErrorStream` is read and the other never while `waitFor()` is called or the read stream is read to its end. Deterministic, provable per finding. Advisory.
Other · Security — Whether a hand-rolled public/private IP check can be walked past — a method that unwraps IPv4-mapped IPv6 but returns the opposite verdict for the same host written as IPv4-compatible, 6to4 or NAT64.
Method: Roslyn syntax + semantics: methods that unwrap IPv4-mapped IPv6 and hand-roll IPv4 range carve-outs, checked for whether the IPv6 branch also accounts for the IPv4-compatible, 6to4 and NAT64 embeddings. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X15 · Unvalidated length from an untrusted reader2.9 / 10Weak✓ Tool-verified
Other · Security — Whether a length read out of the stream being parsed is bounded before it is allocated or read — an unchecked count taken from the input lets the input choose the allocation.
Method: Roslyn syntax + semantics: integer lengths read from a BinaryReader and spent on a bulk read or an array allocation, checked for any comparison or bounding call on the value anywhere in the method. Deterministic, provable per finding. Advisory.
`header_len` is read from the bytes being parsed at line 2465 (`int.from_bytes(… 8 bytes …)`), then passed as the size of `read` at line 2466 — and nowhere in its function is `header_len` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: the call reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB (a 64-bit one for more than any machine has), and the reservation either raises `MemoryError` out of a parser whose failure path was written for malformed input, not for hostile input, or succeeds and holds gigabytes for a few bytes on the wire. Bound `header_len` against the bytes actually remaining and a maximum the format allows before reading. — omlx/oq.py:2466
`header_len` is read from the bytes being parsed at line 2499 (`int.from_bytes(… 8 bytes …)`), then passed as the size of `read` at line 2500 — and nowhere in its function is `header_len` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: the call reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB (a 64-bit one for more than any machine has), and the reservation either raises `MemoryError` out of a parser whose failure path was written for malformed input, not for hostile input, or succeeds and holds gigabytes for a few bytes on the wire. Bound `header_len` against the bytes actually remaining and a maximum the format allows before reading. — omlx/oq.py:2500
`header_len` is read from the bytes being parsed at line 1574 (`int.from_bytes(… 8 bytes …)`), then passed as the size of `read` at line 1575 — and nowhere in its function is `header_len` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: the call reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB (a 64-bit one for more than any machine has), and the reservation either raises `MemoryError` out of a parser whose failure path was written for malformed input, not for hostile input, or succeeds and holds gigabytes for a few bytes on the wire. Bound `header_len` against the bytes actually remaining and a maximum the format allows before reading. — omlx/utils/model_loading.py:1575
`length` is read from the bytes being parsed at line 47 (`struct.unpack("<Q")`), then passed as the size of `read` at line 48 — and nowhere in its function is `length` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: the call reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB (a 64-bit one for more than any machine has), and the reservation either raises `MemoryError` out of a parser whose failure path was written for malformed input, not for hostile input, or succeeds and holds gigabytes for a few bytes on the wire. Bound `length` against the bytes actually remaining and a maximum the format allows before reading. — omlx/prefill_helper/adapter.py:48
`header_len` is read from the bytes being parsed at line 123 (`struct.unpack("<Q")`), then passed as the size of `read` at line 124 — and nowhere in its function is `header_len` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: the call reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB (a 64-bit one for more than any machine has), and the reservation either raises `MemoryError` out of a parser whose failure path was written for malformed input, not for hostile input, or succeeds and holds gigabytes for a few bytes on the wire. Bound `header_len` against the bytes actually remaining and a maximum the format allows before reading. — omlx/patches/moe_expert_offload.py:124
`header_len` is read from the bytes being parsed at line 1222 (`struct.unpack("<Q")`), then passed as the size of `read` at line 1223 — and nowhere in its function is `header_len` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: the call reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB (a 64-bit one for more than any machine has), and the reservation either raises `MemoryError` out of a parser whose failure path was written for malformed input, not for hostile input, or succeeds and holds gigabytes for a few bytes on the wire. Bound `header_len` against the bytes actually remaining and a maximum the format allows before reading. — omlx/patches/moe_expert_offload.py:1223
`size` is read from the bytes being parsed at line 213 (`struct.unpack("<Q")`), then passed as the size of `read` at line 214 — and nowhere in its function is `size` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: the call reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB (a 64-bit one for more than any machine has), and the reservation either raises `MemoryError` out of a parser whose failure path was written for malformed input, not for hostile input, or succeeds and holds gigabytes for a few bytes on the wire. Bound `size` against the bytes actually remaining and a maximum the format allows before reading. — omlx/patches/muse_spark/model.py:214
`header_size` is read from the bytes being parsed at line 42 (`struct.unpack("<Q")`), then passed as the size of `read` at line 43 — and nowhere in its function is `header_size` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: the call reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB (a 64-bit one for more than any machine has), and the reservation either raises `MemoryError` out of a parser whose failure path was written for malformed input, not for hostile input, or succeeds and holds gigabytes for a few bytes on the wire. Bound `header_size` against the bytes actually remaining and a maximum the format allows before reading. — omlx/patches/mlx_vlm_qwen4_exp_compat/residency.py:43
`size` is read from the bytes being parsed at line 119 (`struct.unpack("<Q")`), then passed as the size of `read` at line 120 — and nowhere in its function is `size` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: the call reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB (a 64-bit one for more than any machine has), and the reservation either raises `MemoryError` out of a parser whose failure path was written for malformed input, not for hostile input, or succeeds and holds gigabytes for a few bytes on the wire. Bound `size` against the bytes actually remaining and a maximum the format allows before reading. — omlx/patches/deepseek_v41/oq.py:120
`size` is read from the bytes being parsed at line 290 (`struct.unpack("<Q")`), then passed as the size of `read` at line 291 — and nowhere in its function is `size` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: the call reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB (a 64-bit one for more than any machine has), and the reservation either raises `MemoryError` out of a parser whose failure path was written for malformed input, not for hostile input, or succeeds and holds gigabytes for a few bytes on the wire. Bound `size` against the bytes actually remaining and a maximum the format allows before reading. — omlx/patches/deepseek_v41/oq.py:291
`length` is read from the bytes being parsed at line 18 (`struct.unpack("<Q")`), then passed as the size of `read` at line 19 — and nowhere in its function is `length` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: the call reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB (a 64-bit one for more than any machine has), and the reservation either raises `MemoryError` out of a parser whose failure path was written for malformed input, not for hostile input, or succeeds and holds gigabytes for a few bytes on the wire. Bound `length` against the bytes actually remaining and a maximum the format allows before reading. — omlx/patches/deepseek_v41/oq_inventory.py:19
`length` is read from the bytes being parsed at line 140 (`struct.unpack("<Q")`), then passed as the size of `read` at line 141 — and nowhere in its function is `length` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: the call reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB (a 64-bit one for more than any machine has), and the reservation either raises `MemoryError` out of a parser whose failure path was written for malformed input, not for hostile input, or succeeds and holds gigabytes for a few bytes on the wire. Bound `length` against the bytes actually remaining and a maximum the format allows before reading. — omlx/patches/deepseek_v41/storage.py:141
`size` is read from the bytes being parsed at line 115 (`struct.unpack("<Q")`), then passed as the size of `read` at line 116 — and nowhere in its function is `size` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: the call reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB (a 64-bit one for more than any machine has), and the reservation either raises `MemoryError` out of a parser whose failure path was written for malformed input, not for hostile input, or succeeds and holds gigabytes for a few bytes on the wire. Bound `size` against the bytes actually remaining and a maximum the format allows before reading. — omlx/admin/hf_uploader.py:116
What to do
Each finding names the read that takes the length from the input and the site that spends it, and states that the value is never compared in between. Confirm from the two, then bound the length against the remaining stream before using it.
Other · Code Health — Whether a loop that shortens a string until it fits a length budget has a floor — one with none grinds the value down to the empty string, or past it into a negative-length `Substring`.
Method: Roslyn syntax + semantics: while/do loops whose body's only effect on a string is to drop its last character, checked for whether anything — a direct comparison on the length, a body guard, a break — bounds that length below. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `while`/`do` loop whose body’s one assignment to a value is `x = x.slice(0, -1)` or `x = x.slice|substring|substr(0, x.length - 1)`, driven by a condition that reads `x.length` only as a term of a larger expression — never compared directly, never tested for truthiness, and with no other read of `x` — and whose body has no `break`, `return`, `throw` or `if` naming `x`. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X17 · Uncapped recursion over a caller-supplied document2.0 / 10Critical✓ Tool-verified
Other · Security — Whether a walk that recurses through a JSON/XML tree handed in by its caller bounds how deep it will go — an uncapped walk lets the document's nesting choose the stack depth, and the resulting StackOverflowException cannot be caught.
Method: Roslyn syntax + semantics: methods that take a JSON/XML document node and call themselves with a child of it, reachable from an externally-callable member of the same type that accepts a document, checked for any depth parameter, descent counter or threaded arithmetic anywhere in the walk. On a repository with no .NET source it reads TypeScript off the engine’s own token stream (test, vendored, generated and minified paths and `.d.ts` not) with the same rule: a function or method with a parameter typed as a document value — `unknown`, `any`, `object`, `Record<string, unknown|any>`, a JSON alias (`JsonValue`, `JSONObject`, …) or a DOM node global the file does not rebind — that calls itself (bare, or through `this` for a method, or hands itself to a call over the value as in `value.map(walk)`) with something it took out of that value and never through an ancestor accessor such as `closest()` or `parentElement`, that is exported or reached from an exported function (a public method of the same exported class) taking such a value, and that names no depth, level, nesting, recursion, remaining or budget anywhere and threads no `+`/`-` arithmetic through a self-call. Plain JavaScript is not read: with no annotation nothing tells a parsed document from a tree the code built itself. Deterministic, provable per finding. Advisory.
`collect_kv_layer_specs` is public, takes a document from its caller (line 1925) and hands it to `_walk`, which calls itself at line 1975 (`_walk`) with a piece of `c` — and nowhere in `_walk` 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 `_walk` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — REDACTED:1975
`from_state` is public, takes a document from its caller (line 251) and hands it to `_from_wire_state`, which calls itself at line 99 (`_from_wire_state`) with a piece of `state` — and nowhere in `_from_wire_state` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_from_wire_state` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — omlx/cluster/prompt_snapshot_cache.py:99
`find_lone_surrogate` is public and takes `value: Any` from its caller, and it calls itself at line 42 (`find_lone_surrogate`) with a piece of `value` (and at line 47) — and nowhere in `find_lone_surrogate` 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 `find_lone_surrogate` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — omlx/api/utils.py:42
`chat_template_preserves_mid_system` is public, takes a document from its caller (line 437) and hands it to `_freeze_template_value`, which calls itself at line 363 (`_freeze_template_value`) with a piece of `value` (and at line 366, line 368) — and nowhere in `_freeze_template_value` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_freeze_template_value` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — omlx/api/utils.py:363
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 type's disposal matches what it OWNS — releasing what it created, leaving alone what it was handed, and not declaring a finalizer for state that has nothing unmanaged to finalize.
Method: Roslyn syntax + semantics: every assignment to a disposable field is read to decide whether the type CREATED the value or was handed it, and the type's disposal is checked against that answer — an injected interface it disposes, a value it constructed and never releases, a finalizer on a type holding nothing unmanaged, and a disposable local whose every reference is a plain member read. A value handed to a container that disposes its contents (a parent control's `Controls` collection, a component `IContainer`) is released by that container and is not reported; generated code is out of population. On a repository with no .NET source the same ownership questions are read in JavaScript/TypeScript off the engine’s own token stream (test, vendored, generated and minified paths not): a class declaring `dispose()`, `[Symbol.dispose]()` or `[Symbol.asyncDispose]()` that disposes a field it was handed through a constructor parameter typed as a repository interface or resolved by a dependency-injection container; that assigns a field only ever from `new X(…)` of a disposable class and neither releases it anywhere in the class nor names it in its disposal member or a method that member calls, nor hands it to anything else; and a `const`/`let` local built from literals only whose every reference opens a statement operating on a non-release member of it. A class is disposable when every repository declaration of its name declares or inherits a disposal member, or when it is a documented library disposable (`vscode` EventEmitter, CancellationTokenSource and Disposable; three.js geometries, materials, textures, render targets, renderers, controls and composers). The finalizer arm has no JavaScript counterpart: a class cannot declare one. Dart is read for the owned-and-never-released arm: a Flutter `State` (or a class declaring `dispose()`/`close()`) whose library-private field is written only with direct creations of a framework controller, `FocusNode`, `StreamController` or periodic `Timer` (or a `.listen(…)` into a field declared `StreamSubscription`), which nothing in the class or its library releases (`dispose`/`close`/`cancel`) and which is never handed on except as a named argument. Ruby is read for the owned-and-never-released arm and the abandoned-local arm: a class declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose instance variable is written only with a blockless core descriptor creation (`File.open`/`new`, `Tempfile`, `Dir.open`, `IO.popen`, the `socket` and `openssl` socket classes) that no method of the class closes and that is never handed on (passed, returned, stored, exposed by `attr_reader`, delegated) — a class whose superclass or mixin lies outside the repository is not judged — and a blockless creation read through and dropped (`File.open(path).read`) or held in a local that is never closed, returned, passed or stored (a `&:read` block-pass, an `autoclose: false` borrow and a `fileno` hand-over are not abandonment). PHP is read for the same two arms: a class (not a trait, and not one using a trait) declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose `private` property (or a `final` class's `protected` one) is written only with a direct core `fopen`, `tmpfile`, `popen`, `proc_open`, `fsockopen`, `stream_socket_client`/`server` or `opendir` that nothing in the class closes (`fclose`, `pclose`, `closedir`, `unset`, a reset to `null`) and that is never handed on, and a handle held in a function's local, or read through as the argument of a reader, that is never closed, returned, passed, captured or stored; a `php://` stream, `curl_init`, `SplFileObject`, `PDO` and a function the repository declares under the core name are not read. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a method that temporarily changes state belonging to the whole process — the working directory, an environment variable — puts it back on EVERY path: a restore reached only when nothing throws leaks the change to the rest of the process.
Method: Roslyn syntax + semantics: method bodies that write the process working directory or an environment variable and write it back in the same body, checked for whether that restore sits in a `finally`/`catch` or only on the straight-line path. On a repository with no .NET source the same rule reads production JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not): `process.chdir`, `process.env.NAME =`/`["NAME"] =` and `delete process.env.NAME`, and Deno’s `Deno.chdir`/`Deno.env.set`/`Deno.env.delete`, paired per function body (a nested function or arrow is its own body, and module top-level code is none), where the last write puts back a local the body captured from the same global or deletes a variable the first write set, with at least one statement between them; a write in a `catch`/`finally` of that body silences it. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether async functions that make a cancellable request accept or pass on an AbortSignal (adoption curve).
Method: Roslyn scan: every async method (excluding framework-fixed overrides/Blazor handlers) checked for CancellationToken parameter presence. Deterministic, adoption percentage. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same question: every named async function that itself makes a request an AbortSignal can cancel (global `fetch`, axios and its file-local instances, ky, ofetch) counts, and it is compliant when its parameters or body name a signal or it hands one of its own parameters to the request as options; signatures a framework fixes (JSX event handlers, route and lifecycle exports, request-first handlers, `override`, `'use server'` modules, TanStack `mutationFn`) are exempt unless they take a signal. Deterministic, adoption percentage.
Only 10/108 async functions that make a cancellable request (fetch, axios, ky, ofetch, got, undici, node:http) accept an AbortSignal or pass one on, so a request keeps running after whatever wanted it has given up — a page navigated away from, an unmounted component, a timed-out job. Take a `signal` (or an options object that carries one) and hand it to the request; where nothing could ever cancel the call, omitting it is a deliberate choice — judge against how the function is used.
`checkForUpdate` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:1195
`resetGlobalSettingsDefaults` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:1226
`loadGlobalSettings` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:1284
`saveGlobalSettings` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:1402
`createSubKey` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:1552
`deleteSubKey` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:1585
`loadModels` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:1603
`reloadModels` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:1620
`updateModelSetting` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:1641
`loadModel` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:1683
`unloadModel` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:1706
`loadProfilesForModel` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:1892
`loadTemplates` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:1907
`loadProfileFields` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:1920
`loadPresets` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:1937
`refreshPresets` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:1958
`createProfile` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:2447
`applyProfileToForm` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:2497
`deleteProfile` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:2544
`updateProfile` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:2595
`createTemplate` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:2624
`updateTemplate` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:2665
`deleteTemplate` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:2691
`startANETuning` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:2801
`pollANETuning` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:2859
`cancelANETuning` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:2895
`applyANETuningRecommendation` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:2919
`openModelSettings` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:3011
`pollPrefillLending` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:3073
`stopPrefillLending` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:3088
`loadPrefillHelperCandidates` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:3129
`pollPrefillHelper` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:3145
`prefillHelperAction` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:3170
`applyPrefillHelper` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:3219
`importMtplxSidecar` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:3337
`saveModelSettings` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:3729
`_settingsActionRequest` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:3826
`loadGenerationDefaults` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:3963
`loadServerInfo` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:4080
What to do
Thread an AbortSignal through async functions that make requests, so the work stops when its caller gives up.
Other · Code Health — Whether a `when` guard is free of side effects — a guard that increments a counter or assigns while deciding whether its arm matches applies that change during PATTERN MATCHING, on an arm that may not be selected, and skips it entirely when a short-circuit to its left answers first.
Method: Roslyn syntax: `when` guards on case labels and switch-expression arms, read for a mutation (`++`/`--`/assignment) sitting in a position the guard's own `&&`/`||`/`??`/`?:`/`?.` can skip. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a method that TAKES a lock or semaphore and gives it back from a flag-guarded `finally` returns the value that flag implies — reporting success while the guard hands the primitive back admits a second caller the exclusion was there to keep out, and reporting failure while the guard keeps it leaves nothing to ever give it back. Also whether a `finally` that gives the primitive back unconditionally can run in a state where the method does not hold it: after a timed wait whose result was discarded, after an acquire inside the `try` that can fail, after the body already released it, or never, because a `return` left between the acquire and the `try`.
Method: Roslyn syntax: `try` statements whose `finally` releases a synchronisation primitive under a bare local-bool guard, where the method also TOOK that same primitive before the `try`, checked for a `return` of a bool literal whose value disagrees with the flag state the method's own straight-line assignments put it in. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether the work a diagnostic log line costs is paid only when that line is wanted — C# evaluates a call's arguments BEFORE the call, so a trace/debug message joined or projected out of a collection is built in full on every pass, and then discarded by a sink the shipped configuration leaves switched off.
Method: Roslyn syntax: log calls at a diagnostic level (a `Log`-prefixed method naming Trace/Debug/Verbose, or a bare `Debug`/`Trace`/`Verbose` on a receiver named for a logger), whose argument list is read for a call whose cost scales with a sequence — a LINQ operator, a materialisation, `string.Join`, a serializer — with no enclosing level check or conditional-compilation region. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `debug`/`trace`/`verbose` call on a receiver named for a logger, or a `log`-prefixed method naming the level, whose argument calls an array operator (`map`/`filter`/`reduce`/`sort`/…), `Array.from`, `Object.keys/values/entries`, `JSON.stringify`/`util.inspect` over anything but a literal, or an array `join` — outside any arrow or function passed as an argument, which the logger calls only when the level is on — with no enclosing `if`, `&&` or `?:` whose condition names a level, a level string, or the `NODE_ENV`/`__DEV__`/`DEV` build switch. Deterministic, provable per finding. Advisory.
`debug` at line 3191 is called with an argument built by `sorted(_READABLE_CACHE_FORMAT_VERSIONS)` (line 3195), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on. — omlx/cache/paged_ssd_cache.py:3191
`debug` at line 247 is called with an argument built by `{ k : v for k, v in self._stats.items() if v > 0 }` (line 249), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on. — omlx/cache/vision_feature_cache.py:247
What to do
In Python, put the construction behind the logger's own check (`if logger.isEnabledFor(logging.DEBUG):`), or pass the collection itself with a `%s` placeholder (`logger.debug("Items %s", items)`) so the logging module renders it only when the record is emitted. The placeholder alone is not the fix when the argument is still built first: it defers the formatting, not a `json.dumps`, a `join` or a comprehension in the argument, and an f-string defers nothing at all.
Do you agree with this assessment?
X24 · Document value interpolated into markup unescaped10.0 / 10Exemplary○ Nothing flagged
Other · Security — Whether text read out of the document being converted is escaped before it is written into generated markup — a value the document's author chose, interpolated into an attribute the surrounding literal delimits, can close that attribute and open another.
Method: Roslyn semantic model over the whole compilation: a string-typed `Value`/`InnerText`/`InnerXml`/`Text` member declared inside `DocumentFormat.OpenXml` or `System.Xml` is a taint SOURCE, propagated through assignments, returns, arguments, tuple elements and string composition to its transitive closure, then read at interpolated-string holes that sit in a markup position the surrounding literal itself delimits. Escaper/encoder calls and enclosing validator conditions cut the flow. Flow- and container-insensitive by construction. A second arm needs no provenance at all and reports a type that CONTRADICTS ITSELF — the same expression escaped at one delimited markup hole and interpolated raw at another hole in the same markup position of the same type, which the type's own escaping proves is a defect without knowing where the value came from. On a repository with no .NET source it reads JavaScript/TypeScript off the token stream with the same rule: a DOM read of raw document text (`getAttribute`, `textContent`, `innerText`, `nodeValue`) is the source, propagated through local bindings and string composition, and judged at template-literal and concatenation holes in the same two delimited markup positions; escapers and validating conditions cut it, and documentation-site, test, vendored and minified scripts are not read. Deterministic, provable per finding. Advisory.
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.
Other · Code Health — Whether a value handed from a callback to the body that waits on it crosses on something built to be crossed — a `Queue<T>`/`List<T>`/`Dictionary<K,V>` written inside an event handler and read back outside it is mutated by two flows at once, and the semaphore or completion source beside it orders how MANY items exist while leaving the collection's own head, tail and backing array unprotected.
Method: Roslyn syntax: method, accessor, local-function and lambda bodies that declare BOTH a non-thread-safe generic collection (`Queue`/`Stack`/`List`/`Dictionary`/`HashSet`/`Sorted*`/`LinkedList`) and a synchronisation primitive (`SemaphoreSlim`/`TaskCompletionSource`/`ManualResetEvent(Slim)`/`AutoResetEvent`/`CountdownEvent`) as locals, then read for a `+=`-registered lambda that raises that primitive while the body outside every lambda waits on it — and, in that scope, a mutating call on the collection inside the lambda paired with a mention of it outside. Any `lock` in the scope abstains it. On a repository with no .NET source the same handoff is read in Java off the engine’s own token stream (test source sets, vendored and demonstration paths not): an `ArrayList`/`LinkedList`/`ArrayDeque`/`PriorityQueue`/`Hash*`/`LinkedHash*`/`Tree*` local and a `CountDownLatch`/`Semaphore`/`CompletableFuture` local, a lambda or anonymous class that raises the primitive and mutates the collection, and a wait outside it; any `synchronized` or `lock()` abstains the body. Because each of those primitives orders what the callback wrote before raising it, only a touch that provably overlaps the callback is convicted: one after the registration and before the next wait, or one in a loop registered-before, waiting on every pass and not declaring the collection. Deterministic, provable per finding. Advisory.
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. Whether a walk over a `Hash` or `Set` (`each`, `each_pair`, `map`, `for … in` and the other block walks) leaves it alone — Ruby refuses `rehash`, `replace`, `compare_by_identity` and `transform_keys!` on a Hash, and `reset`, `replace`, `compare_by_identity` and `map!` on a Set, while it is being iterated: the call raises `RuntimeError` at once and the remaining entries 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.
Do you agree with this assessment?
X29 · Per-element action decided by a fixed element10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a decision taken once per element is taken ABOUT that element — a test inside a counted loop that reads a fixed subscript of the very collection its guarded statement indexes by the loop variable applies element zero's answer to all of them, so the elements that differ from it are all handled wrongly, and in the same direction.
Method: Roslyn syntax only, no semantic model: every `for` statement declaring exactly ONE loop variable, and every `if` inside its body that is not under a nested loop or a lambda. A site enters the population when the `if`’s condition never mentions the loop variable while the statement it guards indexes some collection by that variable ALONE (`c[i]`; `c[i + 1]` and `c[i, j]` are outside it). A finding additionally needs the AGREEING TWIN at the same-collection grain: the condition must read THAT SAME collection at a subscript that does not move — written into the condition, or reached through a local declared BEFORE the loop, so an alias bound inside the body is not followed. Both collection expressions must be simple identifiers. On a repository with no .NET source the same rule reads JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `for (let|var|const x = …; …; …)` with one declarator and a braced body, an alias followed only when it is declared before the loop in a block that encloses it and never assigned inside the loop. 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. (×10) — omlx/_torch_stub.py:401, omlx/_torch_stub.py:412, REDACTED:566, …
`except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. (×30) — REDACTED:596, omlx/engine_pool.py:1121, omlx/engine_pool.py:1138, …
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.
Other · Code Health — Whether log calls use message templates (queryable) rather than interpolated strings.
Method: Roslyn syntax scan: every log call-site counted; interpolated-string first-argument violations flagged. Population is all log calls, not estimated. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `trace`/`debug`/`info`/`warn`/`error`/`fatal`/`verbose`/`silly`/`http`/`log` call on a receiver named for a logger, in a package whose own or an enclosing `package.json` declares a logger that carries values as fields (pino, pino-http, nestjs-pino, Fastify, winston, bunyan, tslog, LogTape, roarr), whose first deciding argument is a template literal with substitutions; an object-literal fields argument is stepped over, a plain string message clears the call. Python is read the same way: a `debug`/`info`/`warning`/`error`/`exception`/`critical`/`log` call on a logger in a file that imports the standard library’s `logging` or structlog (loguru, which formats at the call, is not judged), whose message is a whole f-string with a non-constant field; a `%`-formatted, `.format()`-ed or concatenated message is not convicted, as in C#. PHP is read the same way: a PSR-3 level call (`emergency`…`debug`, `log`) on a logger (`$logger`, `$this->logger`, Laravel’s `Log::`, `logger()`, `\Drupal::logger()`) in a package whose `composer.json` requires a PSR-3 logger or a framework that hands one out (psr/log, Monolog, Laravel, Symfony, Drupal, CakePHP), or a file that imports one, whose message is a double-quoted string interpolating a variable; a single-quoted message clears the call, and `sprintf` or `.` concatenation is not convicted, as in C#. Dart is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on Sentry’s structured logger (`Sentry.logger`) whose message is a whole string literal interpolating a value (`$name`, `${…}`); the `Sentry.logger.fmt` template API clears the call. Dart that logs only through loggers with one message and no fields (package:logging, package:logger, talker, dart:developer) is not applicable rather than a reach gap. Ruby is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on the console gem’s `Console` (declared by a Gemfile, gemspec or Gemfile.lock, or required) or, where SemanticLogger, Ougai or dry-logger is declared or required, on a receiver named for a logger (`logger`, `@logger`, `Rails.logger`, `log`), whose first deciding argument is, as the whole argument, a double-quoted string interpolating a non-constant value (`#{…}`, `#@ivar`); a plain literal clears the call, keyword arguments are the fields, and a block, `%`-format or `+` concatenation is not convicted. Ruby that logs only through the standard Logger (Rails.logger) is not applicable rather than a reach gap. Deterministic.
`debug` at line 455 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog. — omlx/engine_core.py:455
`error` at line 696 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — omlx/engine_core.py:696
`debug` at line 842 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog. — omlx/engine_core.py:842
`warning` at line 1016 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — omlx/engine_core.py:1016
`debug` at line 1096 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog. — omlx/engine_core.py:1096
`warning` at line 1145 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — omlx/engine_core.py:1145
`info` at line 1200 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — omlx/engine_core.py:1200
`debug` at line 1305 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog. — omlx/engine_core.py:1305
`debug` at line 1461 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog. — omlx/engine_core.py:1461
`info` at line 1588 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — omlx/engine_pool.py:1588
`warning` at line 1614 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — omlx/engine_pool.py:1614
`info` at line 1616 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — omlx/engine_pool.py:1616
`info` at line 1650 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — omlx/engine_pool.py:1650
`warning` at line 1667 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — omlx/engine_pool.py:1667
`info` at line 1670 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — omlx/engine_pool.py:1670
`info` at line 2815 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — omlx/engine_pool.py:2815
`info` at line 2922 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — omlx/engine_pool.py:2922
`info` at line 2938 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — omlx/engine_pool.py:2938
`info` at line 2968 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — omlx/engine_pool.py:2968
`warning` at line 2985 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — omlx/engine_pool.py:2985
`debug` at line 3192 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog. — omlx/engine_pool.py:3192
`warning` at line 3752 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — omlx/engine_pool.py:3752
`info` at line 3775 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — omlx/engine_pool.py:3775
`error` at line 3799 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — omlx/engine_pool.py:3799
`warning` at line 3806 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — omlx/engine_pool.py:3806
`warning` at line 3817 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — omlx/engine_pool.py:3817
`info` at line 3849 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — omlx/engine_pool.py:3849
`debug` at line 3894 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog. — omlx/engine_pool.py:3894
`info` at line 3910 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — omlx/engine_pool.py:3910
`info` at line 3926 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — omlx/engine_pool.py:3926
`debug` at line 3934 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog. — omlx/engine_pool.py:3934
`info` at line 3948 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — omlx/engine_pool.py:3948
`warning` at line 3969 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — omlx/engine_pool.py:3969
`error` at line 3980 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — omlx/engine_pool.py:3980
`info` at line 3987 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — omlx/engine_pool.py:3987
`info` at line 4031 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — omlx/engine_pool.py:4031
`warning` at line 4038 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — omlx/engine_pool.py:4038
`info` at line 4126 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — omlx/engine_pool.py:4126
`info` at line 4128 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — omlx/engine_pool.py:4128
`warning` at line 4336 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — omlx/engine_pool.py:4336
Other · Code Health — Whether Ruby's type checker checks nil and is not undermined by assertions — a file Sorbet reads at `# typed: true` or above, or a Steep target `check`s under its default or strict diagnostics, is one where a method call on a `T.nilable(String)` / `String?` is an error, and each `T.must`, `#: as !nil` or `# steep:ignore NoMethod` is the author telling the checker a value cannot be nil.
Method: Roslyn compiler-options scan: NullableContextOptions per project; null-forgiving (!) suppression density per 1k syntax nodes. Deterministic, adoption plus suppression penalty.
This repository commits no Sorbet configuration (`sorbet/config`) and no `Steepfile`, so nothing type-checks its 1 Ruby product file(s): a nilable value reaches a method call silently and raises `NoMethodError: undefined method … for nil` the first time it is nil. A `# typed:` sigil does nothing without a `sorbet/config` beside the code; a Steep run configured only on a command line is not something this check can read.
What to do
Adopt a checker and raise it file by file: with Sorbet, `srb init` (or `bundle exec tapioca init`) commits `sorbet/config`, then move each file's sigil from `# typed: false` to `# typed: true` and on to `strict` as its methods get `sig`s — `spoom bump` does the moving; with Steep, write RBS signatures and `check` the product directories in the `Steepfile` under `D::Ruby.default` or `strict`, not `lenient`. Then pay down the assertions rather than adding to them: each `T.must` is a nil the checker could not rule out — narrow it (`return unless x`, `x&.`, `if (y = x)`), make the attribute non-nilable and set it in `initialize`, or change the method so the nil cannot arrive.
Do you agree with this assessment?
WCAG coverage — what static analysis assessed
Statically assessed 15 of 55 WCAG 2.2 Level A/AA success criteria (27%; ≈30% of the 50 WCAG 2.1 AA criteria for EN 301 549). The other 40 require runtime or manual evaluation. Partial signal only (a clean result is necessary, not sufficient; static analysis fully verifies none). This is accessibility readiness, not a conformance claim — a WCAG conformance claim requires manual evaluation (WCAG-EM 1.0).
The score is the rank-weighted fold of these lenses (worst-heaviest), each including its meta-dimensions; a lens with a Critical contributor is capped at Fair (its band reads "gated by …") and is never the strongest area however high its average.
Unscored — 3 check(s) recorded observations but carry no score
These checks ran and found something, but they do not carry a score — either by design (an advisory check reports evidence rather than grading it) or because they could not be scored here. They are excluded from the score for that reason, not because there was nothing to see.
X10 Duplicated predicate — 25 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X6 Hand-rolled structured-format parsing — 15 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X7 Silent fallback defaults — 40 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 4 control(s) we could not find positive evidence for
These checks grade a working control, and the repository shows no evidence of one. That is deliberately not scored as a zero: a repository cannot show an ops runbook, a database TTL or an infrastructure-side audit log, so absence of evidence here is not evidence the control is missing. It is also not a statement that the check is irrelevant to this codebase — the thing it grades applies; we just could not see it. Excluded from the score either way.
C3 Audit Trail — Not assessed: these audit controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks audit controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C4 Data Retention — Not assessed: these retention controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks retention controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C5 Data-Subject Rights — Not assessed: these data-subject rights controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks data-subject rights controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 45 check(s) not relevant to this codebase
These checks had nothing to measure here (no tests, no git history, the codebase is small, or the architecture style doesn't apply), so they're omitted above rather than scored low.
AX1 Captive dependencies — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
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 class or module declares an abstract method
AX7 Slice cohesion — not applicable — not a vertical-slice architecture
AX8 Test isolation — no test/production split to check
AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
AXR1 Runtime accessibility — the service exited before it opened a port — `/tmp/wd-venv/bin/python -m uvicorn 'omlx.server:app' --host 127.0.0.1 --port 8000`: 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 995, in exec_module
File "<frozen importlib…; runtime evidence skipped (launch chosen because REDACTED defines the FastAPI application 'app' at module level) This is a statement about this run, not a statement about your application: nothing here says the surface is inaccessible, only that it was never rendered.
C1 Data Protection — Not assessed: these personal data controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks personal data controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C2 Access Controls — Not assessed: these authorization controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks authorization controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
D11 Test Reliability — Test reliability not included — the .py suite was found but not re-run
D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
D21 Naming Consistency — Naming consistency is measured on C# and TypeScript only; JavaScript, Python, Ruby, Swift, html not measured.
D22 Internal API Consistency — The exposed public-API surface could not be collected — no C#/VB projects loaded.
D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ sibling projects each declaring an entity of their own or taking another project's integration events. Aggregate roots were found in only one source directory (omlx), which is a layered codebase, not two contexts. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
D25 ADR Conformance — no ADRs to check
D28 Secrets (history) — gitleaks killed before it finished — this repository's git history not scanned
D30 Dependency Vulnerabilities — Not scored — no dependency manifest in a supported ecosystem was read for this repository. A gap in the analyzer's language coverage, NOT a finding that the repository is free of vulnerable dependencies (a Python REDACTED/requirements.txt (pip/uv/Poetry) — not scanned yet).
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) — 26 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
D39 IL Efficiency — D39 measures the IL emitted by a .NET build; this repository has no .NET solution or project files, so the dimension does not apply.
D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
D43 Malicious Dependencies — Not scored — no dependency manifest in a supported ecosystem was read for this repository. A gap in the analyzer's language coverage, NOT a finding that the repository is free of vulnerable dependencies (a Python REDACTED/requirements.txt (pip/uv/Poetry) — not scanned yet).
D5 Coupling — Not applicable — this Python build ships 1 production module(s), so there is no coupling BETWEEN modules to measure. (Its test and non-production modules are not part of the shipped graph.)
D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
D8 Code Coverage — Coverage not included — suite not readable by the collector
ED2 Event/command shape — not scored — deciding whether a command has more than one competing handler requires resolving the call graph, and this analysis resolves a call's owner only where the receiver's type is written down in the source. Reported as guidance rather than measured
ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
ES1 Event Sourcing — not scored — this repository shows none of the 3 signals this lens looks for
GD1 Unfinished & placeholder code — no source files were read — this check reads C#, F#, JavaScript/TypeScript, Dart, Ruby and Scala, and none was read for this repository's product. That is a limit of the analyzer, not a finding about your code.
IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
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'.
P8 Schema migrations — no ORM, schema-migration tool or schema auto-create was found in this repository's dependency manifests or source, so there is no database schema for this check to judge
P9 Domain vs controller coverage — no coverage report found on disk — produce a coverage report in a standard format (`coverage run -m pytest` then `coverage xml`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures, or wire coverage collection into CI, to enable this cross-layer check
PF1 Benchmark discipline — Not applicable: no benchmark suite was found. This check searched for a 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 applicable: allocation awareness is rated where code engineers for it — at least 400 production lines that ship benchmarks or already use allocation-aware idioms (8 or more). This repository's Swift code has 46,535 production line(s), 7 such use(s) and no benchmarks, so there is no allocation work to rate. The card is reward-only: its absence costs nothing.
R11 Import Boundaries — No recognizable feature-sliced/layered src layout — boundary rules not applicable.
R5 Dependency Freshness — no package-lock.json — dependency freshness not measured (would require an npm lockfile); JS/npm CVEs are scored in D30 (Dependency Vulnerabilities), which answers every ecosystem
R6 Tooling — no package.json in the repository — test/lint/typecheck wiring is read from package.json scripts (corroborated against CI), so this project's own toolchain isn't measured here
R8 Dependency Hygiene — Not measured — no package.json declares any dependency, so there is nothing to check imports against (imports may resolve through a host runtime rather than node).
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.
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.
X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
X9 Subsumed condition operand — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
Appendix A — Findings (grouped)
The findings behind the scores, grouped by severity, then by dimension and kind. The high-severity issues are enumerated in full below; items per group are capped at 25 with any overflow stated explicitly per group, never silently truncated. The complete machine-readable list of every finding (all severities) is the companion findings.md in this report's bundle.
Critical — 75 finding(s)
AC4 · Keyboard semantics· Click handler on a non-interactive <div> · ×19
Click handler on a non-interactive <div> apps/omlx-web/omlx_web/templates/chat.html:1924— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> apps/omlx-web/omlx_web/templates/chat.html:2475— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> apps/omlx-web/omlx_web/templates/chat.html:2711— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> apps/omlx-web/omlx_web/templates/chat.html:2764— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> apps/omlx-web/omlx_web/templates/dashboard.html:66— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> apps/omlx-web/omlx_web/templates/dashboard/_bench.html:551— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> REDACTED:8— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> apps/omlx-web/omlx_web/templates/dashboard/_modal_settings_apply.html:7— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> apps/omlx-web/omlx_web/templates/dashboard/_models.html:86— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> apps/omlx-web/omlx_web/templates/dashboard/_models.html:90— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> apps/omlx-web/omlx_web/templates/dashboard/_models.html:94— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> apps/omlx-web/omlx_web/templates/dashboard/_settings.html:1753— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> apps/omlx-web/omlx_web/templates/dashboard/_settings.html:1757— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> apps/omlx-web/omlx_web/templates/dashboard/_settings.html:1761— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> apps/omlx-web/omlx_web/templates/dashboard/_settings.html:1765— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> apps/omlx-web/omlx_web/templates/dashboard/_settings.html:1769— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> apps/omlx-web/omlx_web/templates/dashboard/_settings.html:1773— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> apps/omlx-web/omlx_web/templates/dashboard/_settings.html:1777— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> apps/omlx-web/omlx_web/templates/dashboard/_settings.html:2318— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
AC2 · Forms & labels· <label> that labels no control · ×16
<label> that labels no control apps/omlx-web/omlx_web/templates/chat.html:2127— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control apps/omlx-web/omlx_web/templates/chat.html:2492— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control apps/omlx-web/omlx_web/templates/chat.html:2503— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control apps/omlx-web/omlx_web/templates/chat.html:2548— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control apps/omlx-web/omlx_web/templates/chat.html:2560— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control apps/omlx-web/omlx_web/templates/chat.html:2564— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control apps/omlx-web/omlx_web/templates/chat.html:2573— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control apps/omlx-web/omlx_web/templates/chat.html:2585— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control apps/omlx-web/omlx_web/templates/chat.html:2608— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control apps/omlx-web/omlx_web/templates/chat.html:2726— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control apps/omlx-web/omlx_web/templates/dashboard.html:78— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control apps/omlx-web/omlx_web/templates/dashboard/_bench.html:80— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control apps/omlx-web/omlx_web/templates/dashboard/_bench.html:95— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control apps/omlx-web/omlx_web/templates/dashboard/_bench.html:110— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control apps/omlx-web/omlx_web/templates/dashboard/_bench.html:137— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control apps/omlx-web/omlx_web/templates/dashboard/_bench.html:190— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
AC2 · Forms & labels· <button> with no accessible text · ×8
<button> with no accessible text apps/omlx-web/omlx_web/templates/chat.html:1389— A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
<button> with no accessible text apps/omlx-web/omlx_web/templates/chat.html:2225— A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
<button> with no accessible text apps/omlx-web/omlx_web/templates/chat.html:2303— A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
<button> with no accessible text apps/omlx-web/omlx_web/templates/chat.html:2308— A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
<button> with no accessible text apps/omlx-web/omlx_web/templates/chat.html:2697— A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
<button> with no accessible text apps/omlx-web/omlx_web/templates/chat.html:2720— A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
<button> with no accessible text apps/omlx-web/omlx_web/templates/chat.html:2770— A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
<button> with no accessible text apps/omlx-web/omlx_web/templates/dashboard.html:72— A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
AC2 · Forms & labels· <input> without a programmatic label · ×7
<input> without a programmatic label apps/omlx-web/omlx_web/templates/chat.html:1220— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<input> without a programmatic label apps/omlx-web/omlx_web/templates/chat.html:1284— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<input> without a programmatic label apps/omlx-web/omlx_web/templates/chat.html:2269— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<input> without a programmatic label apps/omlx-web/omlx_web/templates/chat.html:2566— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label apps/omlx-web/omlx_web/templates/chat.html:2575— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label apps/omlx-web/omlx_web/templates/dashboard.html:81— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<input> without a programmatic label apps/omlx-web/omlx_web/templates/dashboard/_bench.html:191— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
AC2 · Forms & labels· <select> without a programmatic label · ×4
<select> without a programmatic label apps/omlx-web/omlx_web/templates/chat.html:2135— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<select> without a programmatic label apps/omlx-web/omlx_web/templates/chat.html:2727— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<select> without a programmatic label apps/omlx-web/omlx_web/templates/dashboard/_bench.html:81— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<select> without a programmatic label apps/omlx-web/omlx_web/templates/dashboard/_bench.html:96— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
AC2 · Forms & labels· Custom control with no accessible name on <div> · ×3
Custom control with no accessible name on <div> apps/omlx-web/omlx_web/templates/chat.html:1924— This <div> carries a click handler, which makes it a control, but it has no text, aria-label or labelled child (the icon-only case), so assistive tech has no name to announce for it. Note that switching it to <button type="button"> — the right fix for its keyboard operability — does not give it a name either: an icon-only button still needs one. Add visible text or an aria-label.
Custom control with no accessible name on <div> apps/omlx-web/omlx_web/templates/chat.html:2711— This <div> carries a click handler, which makes it a control, but it has no text, aria-label or labelled child (the icon-only case), so assistive tech has no name to announce for it. Note that switching it to <button type="button"> — the right fix for its keyboard operability — does not give it a name either: an icon-only button still needs one. Add visible text or an aria-label.
Custom control with no accessible name on <div> apps/omlx-web/omlx_web/templates/dashboard.html:66— This <div> carries a click handler, which makes it a control, but it has no text, aria-label or labelled child (the icon-only case), so assistive tech has no name to announce for it. Note that switching it to <button type="button"> — the right fix for its keyboard operability — does not give it a name either: an icon-only button still needs one. Add visible text or an aria-label.
AC2 · Forms & labels· <textarea> without a programmatic label · ×2
<textarea> without a programmatic label apps/omlx-web/omlx_web/templates/chat.html:2051— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<textarea> without a programmatic label apps/omlx-web/omlx_web/templates/chat.html:2494— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
AC4 · Keyboard semantics· Click handler on a non-interactive <span> · ×2
Click handler on a non-interactive <span> apps/omlx-web/omlx_web/templates/dashboard/_settings.html:563— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <span> apps/omlx-web/omlx_web/templates/dashboard/_settings.html:606— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Boundary-crossing change coupling: PerformanceScreen.swift ↔ routes.py apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift:1— `apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift` (context omlx-mac) and `omlx/admin/routes.py` (context omlx) sit in DIFFERENT parts of the tree yet change together 70% of the time (7 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `e6d5989e` fix(cache): turn the SSD cache off when its configured dir is unavail…; `0faa19cd` fix: size automatic SSD cache by available space (#3829); `47de6f2b` feat: add global settings reset to WebUI and SwiftUI — run `git show` on any of them.
Boundary-crossing change coupling: PerformanceScreen.swift ↔ settings.py apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift:1— `apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift` (context omlx-mac) and `omlx/settings.py` (context omlx) sit in DIFFERENT parts of the tree yet change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `e6d5989e` fix(cache): turn the SSD cache off when its configured dir is unavail…; `0faa19cd` fix: size automatic SSD cache by available space (#3829); `23175e10` feat: prefill priority setting (max context vs speed) — run `git show` on any of them.
AC4 · Keyboard semantics· Hover-only interaction on <div> · ×1
Hover-only interaction on <div> apps/omlx-web/omlx_web/templates/chat.html:2326— This <div> binds mouse-enter and mouse-leave and nothing else — no click, no key handler, no focus handler, and no tabindex="0", so it cannot even take focus. A keyboard user cannot hover, so whatever the pair reveals or highlights is reachable with a mouse only. Bind the same state to focus/blur as well, and add tabindex="0"="0" so the element can receive that focus.
AC4 · Keyboard semantics· Hover-only interaction on <i> · ×1
Hover-only interaction on <i> apps/omlx-web/omlx_web/templates/dashboard/_bench.html:6— This <i> binds mouse-enter and mouse-leave and nothing else — no click, no key handler, no focus handler, and no tabindex="0", so it cannot even take focus. A keyboard user cannot hover, so whatever the pair reveals or highlights is reachable with a mouse only. Bind the same state to focus/blur as well, and add tabindex="0"="0" so the element can receive that focus.
AC4 · Keyboard semantics· Click handler on a non-interactive <p> · ×1
Click handler on a non-interactive <p> REDACTED:422— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
AC4 · Keyboard semantics· Hover-only interaction on <span> · ×1
Hover-only interaction on <span> apps/omlx-web/omlx_web/templates/dashboard/_models.html:1400— This <span> binds mouse-enter and mouse-leave and nothing else — no click, no key handler, no focus handler, and no tabindex="0", so it cannot even take focus. A keyboard user cannot hover, so whatever the pair reveals or highlights is reachable with a mouse only. Bind the same state to focus/blur as well, and add tabindex="0"="0" so the element can receive that focus.
FileTooLong: omlx/scheduler.py omlx/scheduler.py— FileTooLong — 11260 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 10760 over it, 22.52× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: omlx/oq.py omlx/oq.py— FileTooLong — 8571 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 8071 over it, 17.14× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: admin/routes.py omlx/admin/routes.py— FileTooLong — 6916 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 6416 over it, 13.83× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: REDACTED REDACTED— FileTooLong — 6818 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 1500 significant lines; this is 5318 over it, 4.55× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: REDACTED REDACTED— FileTooLong — 6800 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 6300 over it, 13.60× 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: engine/vlm.py omlx/engine/vlm.py— FileTooLong — 4394 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 3894 over it, 8.79× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: templates/chat.html apps/omlx-web/omlx_web/templates/chat.html— FileTooLong — 4025 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: chatApp (2841-8499). The bar is 500 significant lines; this is 3525 over it, 8.05× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: cache/prefix_cache.py omlx/cache/prefix_cache.py— FileTooLong — 3707 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 3207 over it, 7.41× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: cache/paged_ssd_cache.py omlx/cache/paged_ssd_cache.py— FileTooLong — 3598 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 3098 over it, 7.20× 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: omlx/engine_pool.py omlx/engine_pool.py— FileTooLong — 3432 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2932 over it, 6.86× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: REDACTED REDACTED— FileTooLong — 3363 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2863 over it, 6.73× 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: cluster/routes.py omlx/cluster/routes.py— FileTooLong — 2975 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2475 over it, 5.95× 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: js/cluster_v2.js apps/omlx-web/omlx_web/static/js/cluster_v2.js— FileTooLong — 2935 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units), about 100% of them inside a single declaration: clusterV2Wizard (49-4216). The bar is 1500 significant lines; this is 1435 over it, 1.96× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: patches/qwen35_ane_prefill.py omlx/patches/qwen35_ane_prefill.py— FileTooLong — 2823 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2323 over it, 5.65× 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: cluster/launch.py omlx/cluster/launch.py— FileTooLong — 2589 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2089 over it, 5.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: api/tool_calling.py omlx/api/tool_calling.py— FileTooLong — 2497 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1997 over it, 4.99× 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: Screens/ModelSettingsScreen.swift apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift— FileTooLong — 2319 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1819 over it, 4.64× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: mlx_vlm_glm5_next_compat/decode_kernels.py omlx/patches/mlx_vlm_glm5_next_compat/decode_kernels.py— FileTooLong — 2308 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1808 over it, 4.62× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: admin/ane_tuning.py omlx/admin/ane_tuning.py— FileTooLong — 2062 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1562 over it, 4.12× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: deepseek_v4/deepseek_v4_model.py omlx/patches/deepseek_v4/deepseek_v4_model.py— FileTooLong — 2002 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1502 over it, 4.00× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: ViewModels/ModelSettingsScreenVM.swift apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift— FileTooLong — 1796 significant lines (blank, comment-only and punctuation-only lines excluded), about 93% of them inside a single declaration: ModelSettingsScreenVM (36-2425). The bar is 500 significant lines; this is 1296 over it, 3.59× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: REDACTED REDACTED— FileTooLong — 1697 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1197 over it, 3.39× 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: admin/benchmark.py omlx/admin/benchmark.py— FileTooLong — 1684 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1184 over it, 3.37× 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: cluster/planner.py omlx/cluster/planner.py— FileTooLong — 1684 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1184 over it, 3.37× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: REDACTED REDACTED— FileTooLong — 1682 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1182 over it, 3.36× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
Hotspot: omlx/admin/routes.py omlx/admin/routes.py:4872— omlx/admin/routes.py changed 119 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 290 in routes.update_global_settings at line 4872. 48 of those changes were fix/bug commits, and the other 71 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-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- omlx/admin/routes.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: REDACTED REDACTED:132— REDACTED changed 137 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 159 in dashboard.dashboard at line 132. 11 of those changes were fix/bug commits, and the other 126 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-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: omlx/scheduler.py omlx/scheduler.py:13222— omlx/scheduler.py changed 187 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 99 in Scheduler._schedule_waiting at line 13222. 111 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- omlx/scheduler.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: apps/omlx-web/omlx_web/templates/chat.html apps/omlx-web/omlx_web/templates/chat.html:2841— apps/omlx-web/omlx_web/templates/chat.html changed 41 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 412 in chat.html.chatApp at line 2841. 16 of those changes were fix/bug commits, and the other 25 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- apps/omlx-web/omlx_web/templates/chat.html`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: REDACTED REDACTED:6628— REDACTED changed 130 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 115 in server.stream_chat_completion at line 6628. 71 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: omlx/engine/vlm.py omlx/engine/vlm.py:4045— omlx/engine/vlm.py changed 121 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 116 in VLMBatchedEngine._prepare_vision_inputs at line 4045. 57 of those changes were fix/bug commits, and the other 64 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-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- omlx/engine/vlm.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: omlx/cache/prefix_cache.py omlx/cache/prefix_cache.py:3286— omlx/cache/prefix_cache.py changed 36 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 252 in BlockAwarePrefixCache.reconstruct_cache at line 3286. 23 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- omlx/cache/prefix_cache.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: omlx/utils/model_loading.py omlx/utils/model_loading.py:519— omlx/utils/model_loading.py changed 59 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 142 in model_loading.maybe_apply_pre_load_patches at line 519. 18 of those changes were fix/bug commits, and the other 41 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-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- omlx/utils/model_loading.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: omlx/oq.py omlx/oq.py:6883— omlx/oq.py changed 53 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 151 in oq.quantize_oq_streaming at line 6883. 23 of those changes were fix/bug commits, and the other 30 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-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- omlx/oq.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: omlx/engine_pool.py omlx/engine_pool.py:4092— omlx/engine_pool.py changed 91 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 82 in EnginePool._load_engine at line 4092. 41 of those changes were fix/bug commits, and the other 50 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-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- omlx/engine_pool.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: apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:866— apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift changed 35 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 143 in ModelSettingsScreenVM.save at line 866. 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-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift`: 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: omlx/cache/paged_ssd_cache.py omlx/cache/paged_ssd_cache.py:3454— omlx/cache/paged_ssd_cache.py changed 40 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 86 in PagedSSDCacheManager.save_block at line 3454. 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-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- omlx/cache/paged_ssd_cache.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: omlx/patches/qwen35_ane_prefill.py omlx/patches/qwen35_ane_prefill.py:3075— omlx/patches/qwen35_ane_prefill.py changed 39 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 81 in qwen35_ane_prefill.enable_qwen35_ane_prefill at line 3075. 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-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- omlx/patches/qwen35_ane_prefill.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: REDACTED REDACTED:4317— REDACTED changed 51 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 56 in batch_generator._run_verify_cycle_chain at line 4317. 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-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: omlx/settings.py omlx/settings.py:1685— omlx/settings.py changed 35 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 68 in GlobalSettings.validate at line 1685. 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-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- omlx/settings.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: REDACTED REDACTED:289— REDACTED changed 55 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 41 in BatchedEngine.start at line 289. 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-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: omlx/cluster/routes.py omlx/cluster/routes.py:1205— omlx/cluster/routes.py changed 31 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 71 in routes.cluster_autoconfigure at line 1205. 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-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- omlx/cluster/routes.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: omlx/api/tool_calling.py omlx/api/tool_calling.py:2050— omlx/api/tool_calling.py changed 36 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 56 in tool_calling._parse_tool_calls_impl at line 2050. 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-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- omlx/api/tool_calling.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: omlx/model_discovery.py omlx/model_discovery.py:710— omlx/model_discovery.py changed 35 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 54 in model_discovery.detect_model_type at line 710. 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-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- omlx/model_discovery.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: omlx/admin/benchmark.py omlx/admin/benchmark.py:1921— omlx/admin/benchmark.py changed 28 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 62 in benchmark.run_benchmark at line 1921. 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-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- omlx/admin/benchmark.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: REDACTED REDACTED:465— REDACTED changed 27 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 54 in cli.launch_command at line 465. 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-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: omlx/process_memory_enforcer.py omlx/process_memory_enforcer.py:1734— omlx/process_memory_enforcer.py changed 21 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 61 in ProcessMemoryEnforcer._check_and_enforce at line 1734. 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-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- omlx/process_memory_enforcer.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: omlx/patches/deepseek_v41/language.py omlx/patches/deepseek_v41/language.py:1350— omlx/patches/deepseek_v41/language.py changed 16 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 80 in LanguageModel._forward at line 1350. 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-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- omlx/patches/deepseek_v41/language.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: REDACTED REDACTED:2003— REDACTED changed 23 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 53 in HFDownloader._run_download at line 2003. 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-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: omlx/admin/ane_tuning.py omlx/admin/ane_tuning.py:1080— omlx/admin/ane_tuning.py changed 20 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 60 in ane_tuning._calibrate_fused_components_sync at line 1080. 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-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- omlx/admin/ane_tuning.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.
+ 84 more in this group — see findings.md.
X2 · Cancellation propagation· Async function without AbortSignal · ×39
Async function without AbortSignal: checkForUpdate REDACTED:1195— `checkForUpdate` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: resetGlobalSettingsDefaults REDACTED:1226— `resetGlobalSettingsDefaults` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: loadGlobalSettings REDACTED:1284— `loadGlobalSettings` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: saveGlobalSettings REDACTED:1402— `saveGlobalSettings` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: createSubKey REDACTED:1552— `createSubKey` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: deleteSubKey REDACTED:1585— `deleteSubKey` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: loadModels REDACTED:1603— `loadModels` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: reloadModels REDACTED:1620— `reloadModels` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: updateModelSetting REDACTED:1641— `updateModelSetting` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: loadModel REDACTED:1683— `loadModel` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: unloadModel REDACTED:1706— `unloadModel` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: loadProfilesForModel REDACTED:1892— `loadProfilesForModel` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: loadTemplates REDACTED:1907— `loadTemplates` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: loadProfileFields REDACTED:1920— `loadProfileFields` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: loadPresets REDACTED:1937— `loadPresets` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: refreshPresets REDACTED:1958— `refreshPresets` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: createProfile REDACTED:2447— `createProfile` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: applyProfileToForm REDACTED:2497— `applyProfileToForm` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: deleteProfile REDACTED:2544— `deleteProfile` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: updateProfile REDACTED:2595— `updateProfile` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: createTemplate REDACTED:2624— `createTemplate` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: updateTemplate REDACTED:2665— `updateTemplate` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: deleteTemplate REDACTED:2691— `deleteTemplate` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: startANETuning REDACTED:2801— `startANETuning` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: pollANETuning REDACTED:2859— `pollANETuning` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Swallowed exception (caught, then discarded) REDACTED:596— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) omlx/engine_pool.py:1121— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) omlx/engine_pool.py:1138— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) omlx/engine_pool.py:1154— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) omlx/engine_pool.py:1171— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) omlx/engine_pool.py:1188— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) omlx/engine_pool.py:1223— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) omlx/engine_pool.py:2078— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) omlx/engine_pool.py:2087— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) omlx/engine_pool.py:2121— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) REDACTED:412— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) REDACTED:1110— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) REDACTED:1991— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) REDACTED:2016— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) REDACTED:2094— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) omlx/model_discovery.py:935— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) omlx/oq.py:4303— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) omlx/oq.py:4311— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) omlx/oq.py:4317— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) omlx/oq.py:5348— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) omlx/oq.py:5350— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) omlx/oq.py:6749— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) omlx/oq.py:8083— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) omlx/oq.py:11040— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) omlx/oq.py:11879— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Duplicated block (9 lines × 2) omlx/admin/ane_tuning.py:1010— omlx/admin/ane_tuning.py:1010-1018 | omlx/admin/ane_tuning.py:1069-1077 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) omlx/admin/ane_tuning.py:2422— omlx/admin/ane_tuning.py:2422-2430 | omlx/admin/ane_tuning.py:2550-2558 — both copies are in the same file, so extract the 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 `omlx/admin/ane_tuning.py:2422` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) omlx/admin/oq_manager.py:127— omlx/admin/oq_manager.py:127-135 | omlx/oq.py:4271-4279 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) omlx/admin/routes.py:7450— omlx/admin/routes.py:7450-7458 | omlx/admin/routes.py:7566-7574 — both copies are in the same file, so extract the 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) omlx/cache/paged_ssd_cache.py:5364— omlx/cache/paged_ssd_cache.py:5364-5372 | omlx/cache/paged_ssd_cache.py:5450-5458 — both copies are in the same file, so extract the 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 `omlx/cache/paged_ssd_cache.py:5364` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) REDACTED:991— REDACTED:991-999 | REDACTED:1013-1021 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) omlx/cluster/ssh_keys.py:61— omlx/cluster/ssh_keys.py:61-69 | omlx/cluster/ssh_keys.py:73-81 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) omlx/patches/glm_moe_dsa/deepseek_v32.py:991— omlx/patches/glm_moe_dsa/deepseek_v32.py:991-999 | omlx/patches/glm_moe_dsa/deepseek_v32.py:1001-1009 — both copies are in the same file, so extract the 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) omlx/patches/mimo_v2/mimo_v2_model.py:479— omlx/patches/hy_v3/hy_v3_model.py:253-261 | omlx/patches/mimo_v2/mimo_v2_model.py:479-487 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (9 lines × 2) omlx/patches/mlx_lm_mtp/deepseek_v4_dspark.py:126— omlx/patches/mlx_lm_mtp/deepseek_v4_dspark.py:126-134 | REDACTED:156-164 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) omlx/patches/qwen35_ane_prefill.py:744— omlx/patches/qwen35_ane_prefill.py:744-752 | omlx/patches/qwen35_ane_prefill.py:866-874 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) omlx/patches/qwen35_ane_prefill.py:1126— omlx/patches/qwen35_ane_prefill.py:1126-1134 | omlx/patches/qwen35_ane_prefill.py:1370-1378 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) omlx/patches/qwen35_gdn_prework.py:1525— omlx/patches/qwen35_gdn_prework.py:1525-1533 | omlx/patches/qwen35_gdn_prework.py:1689-1697 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `omlx/patches/qwen35_gdn_prework.py:1525` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) REDACTED:5466— REDACTED:5466-5474 | REDACTED:8260-8268 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) REDACTED:7162— REDACTED:7162-7170 | REDACTED:7713-7721 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) REDACTED:9027— REDACTED:9027-9035 | REDACTED:9645-9653 — both copies are in the same file, so extract the 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) omlx/admin/hf_uploader.py:636— omlx/admin/hf_uploader.py:636-653 | omlx/admin/oq_manager.py:575-583 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) omlx/eval/humaneval.py:103— omlx/eval/humaneval.py:103-111 | omlx/eval/livecodebench.py:68-76 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (9 lines × 2) omlx/admin/benchmark.py:613— omlx/admin/benchmark.py:613-621 | omlx/admin/context_benchmark.py:151-159 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (9 lines × 2) apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:316— apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:316-324 | apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:941-950 — 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 `apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:316` 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 (9 lines × 2) apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:637— apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:637-645 | apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:1446-1454 — both copies are in the same file, so extract the 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 `apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:637` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:1300— apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:1300-1308 | apps/omlx-mac/Sources/AppView/Screens/SecurityScreen.swift:410-418 — 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 `apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:1300` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:1309` calls `disabled` and `apps/omlx-mac/Sources/AppView/Screens/SecurityScreen.swift:419` 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 (9 lines × 2) apps/omlx-mac/Sources/AppView/Screens/ContextBenchScreen.swift:242— apps/omlx-mac/Sources/AppView/Screens/ContextBenchScreen.swift:242-250 | apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift:949-957 — before extracting anything, compare `apps/omlx-mac/Sources/AppView/Screens/ContextBenchScreen.swift` and `apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 159 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 `apps/omlx-mac/Sources/AppView/Screens/ContextBenchScreen.swift:242` 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, `apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift:946` calls `font`, `omlxText`, `foregroundStyle` and `apps/omlx-mac/Sources/AppView/Screens/ContextBenchScreen.swift:241` 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) apps/omlx-mac/Sources/AppView/Screens/DownloadsScreen.swift:776— apps/omlx-mac/Sources/AppView/Screens/DownloadsScreen.swift:776-784 | apps/omlx-mac/Sources/AppView/Screens/DownloadsScreen.swift:890-898 — both copies are in the same file, so extract the 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 `apps/omlx-mac/Sources/AppView/Screens/DownloadsScreen.swift:776` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift:235— apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift:235-245 | apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:171-179 — before extracting anything, compare `apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift` and `apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 150 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 `apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift:235` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) omlx/admin/ane_tuning.py:1450— omlx/admin/ane_tuning.py:1450-1456 | omlx/admin/ane_tuning.py:2013-2019 — both copies are in the same file, so extract the 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) REDACTED:1702— REDACTED:1702-1708 | omlx/admin/ms_downloader.py:706-712 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (7 lines × 2) omlx/admin/routes.py:3843— omlx/admin/routes.py:3843-3849 | omlx/admin/routes.py:4373-4379 — both copies are in the same file, so extract the 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 `omlx/admin/routes.py:3843` 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, `omlx/admin/routes.py:3841` calls `set`, `get_model_ids` and `omlx/admin/routes.py:4372` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 2) omlx/cache/prefix_cache.py:2260— omlx/cache/prefix_cache.py:2260-2266 | omlx/cache/prefix_cache.py:2446-2452 — both copies are in the same file, so extract the 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 `omlx/cache/prefix_cache.py:2260` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) omlx/cache/type_handlers.py:1397— omlx/cache/type_handlers.py:1397-1403 | omlx/cache/type_handlers.py:1483-1489 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 2) omlx/cluster/launch.py:426— omlx/cluster/launch.py:426-432 | omlx/cluster/telemetry.py:1799-1805 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (7 lines × 2) omlx/cluster/registry.py:55— omlx/cluster/registry.py:55-61 | omlx/cluster/registry.py:247-253 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 2) REDACTED:1315— REDACTED:1315-1321 | omlx/engine/vlm.py:5054-5060 — before extracting anything, compare `REDACTED` and `omlx/engine/vlm.py` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 2) omlx/models/qwen2_embedding.py:90— omlx/models/qwen2_embedding.py:90-98 | omlx/patches/glm_moe_dsa/deepseek_v32.py:598-604 — 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (7 lines × 2) omlx/oq.py:3693— omlx/oq.py:3693-3699 | omlx/oq.py:3743-3749 — both copies are in the same file, so extract the 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) omlx/oq.py:7845— omlx/oq.py:7845-7851 | omlx/oq.py:11740-11746 — both copies are in the same file, so extract the 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) omlx/oq.py:10391— omlx/oq.py:10391-10397 | omlx/oq.py:10455-10462 — both copies are in the same file, so extract the 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 `omlx/oq.py:10391` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) omlx/patches/deepseek_v4/deepseek_v4_model.py:1877— omlx/patches/deepseek_v4/deepseek_v4_model.py:1877-1883 | omlx/patches/deepseek_v4/deepseek_v4_model.py:2146-2152 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 2) omlx/patches/deepseek_v4/moe_offload.py:126— omlx/patches/deepseek_v4/moe_offload.py:126-132 | omlx/patches/glm_moe_dsa/moe_offload.py:166-172 — `omlx/patches/deepseek_v4/moe_offload.py` and `omlx/patches/glm_moe_dsa/moe_offload.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 10 separate duplicated blocks between them, totalling at least 144 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (7 lines × 2) omlx/patches/turboquant_attention.py:283— omlx/patches/turboquant_attention.py:283-289 | omlx/patches/turboquant_attention.py:663-669 — both copies are in the same file, so extract the 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 `omlx/patches/turboquant_attention.py:283` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) REDACTED:1135— REDACTED:1135-1141 | omlx/admin/hf_uploader.py:36-42 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 2) REDACTED:259— REDACTED:259-265 | omlx/engine/vlm.py:1936-1942 — before extracting anything, compare `REDACTED` and `omlx/engine/vlm.py` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 469 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 (7 lines × 2) omlx/patches/bailing_hybrid/bailing_hybrid_model.py:137— omlx/patches/bailing_hybrid/bailing_hybrid_model.py:137-143 | omlx/patches/bailing_hybrid/swiglu_clamp.py:41-47 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 2) apps/omlx-mac/Sources/AppView/Screens/AccuracyBenchScreen.swift:877— apps/omlx-mac/Sources/AppView/Screens/AccuracyBenchScreen.swift:877-883 | apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift:650-656 — 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 `apps/omlx-mac/Sources/AppView/Screens/AccuracyBenchScreen.swift:877` 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 first that the copies are not typed on the same thing: the declarations holding them bind `spacing` to `8` in one and `0` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (7 lines × 2) apps/omlx-mac/Sources/AppView/Screens/IntegrationsScreen.swift:240— apps/omlx-mac/Sources/AppView/Screens/IntegrationsScreen.swift:240-248 | apps/omlx-mac/Sources/AppView/Screens/StatusScreen.swift:35-41 — 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 `apps/omlx-mac/Sources/AppView/Screens/IntegrationsScreen.swift:240` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (7 lines × 2) apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1732— apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1732-1738 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1741-1747 — both copies are in the same file, so extract the 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 `apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1732` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) apps/omlx-mac/Sources/AppView/Screens/ModelsScreen.swift:120— apps/omlx-mac/Sources/AppView/Screens/ModelsScreen.swift:120-126 | apps/omlx-mac/Sources/AppView/Screens/ModelsScreen.swift:250-256 — both copies are in the same file, so extract the 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 `apps/omlx-mac/Sources/AppView/Screens/ModelsScreen.swift:120` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) apps/omlx-mac/Sources/AppView/Screens/ProfileViews.swift:834— apps/omlx-mac/Sources/AppView/Screens/ProfileViews.swift:834-840 | apps/omlx-mac/Sources/AppView/Screens/ProfileViews.swift:867-873 — both copies are in the same file, so extract the 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 `apps/omlx-mac/Sources/AppView/Screens/ProfileViews.swift:834` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift:526— apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift:526-532 | apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift:625-631 — both copies are in the same file, so extract the 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) apps/omlx-mac/Sources/AskAI/AskAIPanel.swift:132— apps/omlx-mac/Sources/AskAI/AskAIPanel.swift:132-140 | apps/omlx-mac/Sources/AskAI/TalkAIPanel.swift:69-75 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Repeated repair: omlx/prefill_transient_tracker.py omlx/prefill_transient_tracker.py:91— omlx/prefill_transient_tracker.py changed 13 times in last 90 days and 12 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is PrefillTransientTracker.update at line 91), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(scheduler): keep wide prefill chunks for flat-overhead models under memory pressure (#4902)”; “fix: expire prefill outlier samples after their prefill (#4903)”; “fix: account for prefill pool releases and preserve chunk sizing (#3465)”; “fix(qwen4_exp): bound masked SDPA256 memory pricing (#3461)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- omlx/prefill_transient_tracker.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: omlx/patches/sdpa256_attention.py omlx/patches/sdpa256_attention.py:414— omlx/patches/sdpa256_attention.py changed 12 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is sdpa256_attention.apply_sdpa256_attention_patch at line 414), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: keep fp16 head_dim 256 SDPA under the M1/M2 thread limit (#4609)”; “fix(attention): keep SDPA256 prefill on the bounded route (#3685)”; “fix: use tiled attention for FP32 prefill (#3795)”; “fix: scope SDPA headroom providers to engine workers (#3333)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- omlx/patches/sdpa256_attention.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:424— apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift changed 9 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is ServerHeroCard.pillStatus at line 424), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: bracket IPv6 hosts in Server API endpoint URLs (#4043)”; “fix: restore previous settings when reset is canceled”; “fix: clarify pin in memory setting location (#3691)”; “fix(mac): align the macOS app UI with system conventions (#3376)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: omlx/patches/vlm_batch_kv_capacity.py omlx/patches/vlm_batch_kv_capacity.py:297— omlx/patches/vlm_batch_kv_capacity.py changed 5 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is _CapacityMethods.filter at line 297), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: keep batch KV rows and grow long banks one layer at a time (#4907) (#4971)”; “fix: keep long-context batch KV banks in place on finish and rollback (#4907) (#4954)”; “fix(cache): join requests in place and stop batch KV bank growth (#4936)”; “fix(mtp): reduce batched Lightning MTP peak memory at long context (#4916)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- omlx/patches/vlm_batch_kv_capacity.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift:24— apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift changed 6 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 5 (its worst body is PerformanceScreen.body at line 24), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(cache): turn the SSD cache off when its configured dir is unavailable”; “fix: size automatic SSD cache by available space (#3829)”; “fix: restore previous settings when reset is canceled”; “fix(mac): align the macOS app UI with system conventions (#3376)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: omlx/patches/deepseek_v4/utils_patch.py omlx/patches/deepseek_v4/utils_patch.py:46— omlx/patches/deepseek_v4/utils_patch.py changed 6 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is utils_patch._native_ratio128_attention_enabled at line 46), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “chore: reduce #4196, #4300, #4184 and #4182 to the root-cause fixes”; “fix(oq): log sanitizer patch failures at warning level (#4182)”; “fix(deepseek): detect nested low-bit attention overrides (#3560)”; “fix(cluster): harden model loading and SSH pairing”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- omlx/patches/deepseek_v4/utils_patch.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: apps/omlx-mac/Sources/Menubar/MenubarController.swift apps/omlx-mac/Sources/Menubar/MenubarController.swift:382— apps/omlx-mac/Sources/Menubar/MenubarController.swift changed 5 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is MenubarController.refreshMenuState at line 382), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(macos): preserve server restart during stale health updates (#5070)”; “fix(mac): skip menubar icon redraws when the icon did not change (#5049)”; “fix(mac): show the no-API-key stats hint in the menubar All-Time section”; “fix(mac): show counts in 万 and 亿 in Chinese (#3826)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- apps/omlx-mac/Sources/Menubar/MenubarController.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: omlx/exceptions.py omlx/exceptions.py:43— omlx/exceptions.py changed 4 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is exceptions.describe_ceiling_binding at line 43), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: show oMLX's own memory use in dynamic ceiling advice”; “fix(memory-guard): stop rejecting long prompts that fit, and keep their cache afterward (#4554)”; “fix(memory-guard): free hot cache instead of rejecting prompts (#4252)”; “fix(memory-guard): rework tier semantics and prefill accounting (#3933)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- omlx/exceptions.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: omlx/api/responses_models.py omlx/api/responses_models.py:209— omlx/api/responses_models.py changed 4 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 4 (its worst body is ResponseUsage.model_post_init at line 209), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: reject non-positive max tokens on messages, responses and STT”; “fix(responses): route namespace tool groups through to the model and back (#3664)”; “fix(responses): route function_call_output images to vlm instead of prompt text (#2989)”; “fix(responses): surface max_output_tokens truncation as incomplete (#2817)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- omlx/api/responses_models.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: omlx/cluster/system_socket_proxy.py omlx/cluster/system_socket_proxy.py:171— omlx/cluster/system_socket_proxy.py changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is system_socket_proxy.open_system_tcp_proxy at line 171), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: isolate cluster helper python and surface rank failures (#3937, #3967)”; “fix(cluster): preserve control proxy fallback and deadlines (#3577)”; “fix(cluster): direct-first control transport and venv-aware system proxy (#3577)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- omlx/cluster/system_socket_proxy.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: omlx/integrations/dsh.py omlx/integrations/dsh.py:491— omlx/integrations/dsh.py changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is dsh._validate_patch at line 491), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: cache-stack invariants, SSD-tier hygiene, and small hardening follow-ups (#4163)”; “fix(integrations): stop writing duplicate keys into a new dsh patch entry”; “fix(integrations): create the dsh credential store as 0600 and drop unused dsh assets”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- omlx/integrations/dsh.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: apps/omlx-mac/Sources/App/AppDelegate.swift apps/omlx-mac/Sources/App/AppDelegate.swift:632— apps/omlx-mac/Sources/App/AppDelegate.swift changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is AppDelegate.handleAppControl at line 632), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(mac): let logout, restart, and shutdown quit the app (#3323)”; “fix(omlx-mac): stop linking the omlx CLI into /opt/homebrew/bin (#4341)”; “fix(mac): scope main window URL to current app (#2658)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- apps/omlx-mac/Sources/App/AppDelegate.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: apps/omlx-mac/Sources/AppView/Screens/SecurityScreen.swift apps/omlx-mac/Sources/AppView/Screens/SecurityScreen.swift:96— apps/omlx-mac/Sources/AppView/Screens/SecurityScreen.swift changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is APIKeyEditorRow.body at line 96), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: tint the disable-all-authentication switch red (#4899)”; “fix(omlx-mac): reload the API key for menubar status polls (#4450)”; “fix(mac): align the macOS app UI with system conventions (#3376)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- apps/omlx-mac/Sources/AppView/Screens/SecurityScreen.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: omlx/patches/mlx_vlm_minimax_m3_compat/__init__.py omlx/patches/mlx_vlm_minimax_m3_compat/__init__.py:308— omlx/patches/mlx_vlm_minimax_m3_compat/__init__.py changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is mlx_vlm_minimax_m3_compat._normalize_quantization_config at line 308), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(vlm): keep interleaved text and images in order for the generic formatter (#4770)”; “chore: reduce #4298, #4299, #4301, #4305 and #4307 to the root-cause fixes”; “fix(anthropic): stop collapsing thinking_mode adaptive into enabled (#4301)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- omlx/patches/mlx_vlm_minimax_m3_compat/__init__.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: apps/omlx-mac/Sources/App/oMLXApp.swift apps/omlx-mac/Sources/App/oMLXApp.swift:23— apps/omlx-mac/Sources/App/oMLXApp.swift changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 3 (its worst body is OMLXEntryPoint.main at line 23), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(mac): let logout, restart, and shutdown quit the app (#3323)”; “fix: make mac updater swap crash-safe (#2522)”; “fix(mac): scope main window URL to current app (#2658)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- apps/omlx-mac/Sources/App/oMLXApp.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: omlx/eval/livecodebench.py omlx/eval/livecodebench.py:154— omlx/eval/livecodebench.py changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is LiveCodeBenchBenchmark.load_dataset at line 154), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(eval): grade LiveCodeBench functional problems by return value (#4545)”; “fix(eval): keep code scoring off the event loop (#3635)”; “fix(eval): run accuracy benchmark questions through a worker pool (#3635)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- omlx/eval/livecodebench.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: omlx/cluster/guidance.py omlx/cluster/guidance.py:398— omlx/cluster/guidance.py changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 5 (its worst body is guidance.explain at line 398), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(cluster): discover peer runtimes and verify parity (#2697)”; “fix(cluster): harden model loading and SSH pairing”; “fix(cluster): make SSH setup prompt-free”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- omlx/cluster/guidance.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: apps/omlx-mac/Sources/Menubar/MenubarStatsPoller.swift apps/omlx-mac/Sources/Menubar/MenubarStatsPoller.swift:322— apps/omlx-mac/Sources/Menubar/MenubarStatsPoller.swift changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is MenubarStatsPoller.refreshOnce at line 322), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(mac): show the no-API-key stats hint in the menubar All-Time section”; “fix(mac): show counts in 万 and 亿 in Chinese (#3826)”; “fix(omlx-mac): reload the API key for menubar status polls (#4450)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- apps/omlx-mac/Sources/Menubar/MenubarStatsPoller.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: omlx/api/anthropic_models.py omlx/api/anthropic_models.py:109— omlx/api/anthropic_models.py changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 5 (its worst body is anthropic_models._content_block_tag at line 109), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(anthropic): honor tool_choice none on /v1/messages (#4818)”; “fix: reject non-positive max tokens on messages, responses and STT”; “fix(anthropic): accept unknown content block types instead of 422ing (#4201)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- omlx/api/anthropic_models.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: omlx/utils/metal_sync.py omlx/utils/metal_sync.py:106— omlx/utils/metal_sync.py changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 6 (its worst body is metal_sync.unreleased_graphics_bytes at line 106), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(engine): prevent GPU hangs when several models run at once (#4637)”; “fix(memory-guard): rework tier semantics and prefill accounting (#3933)”; “fix: exit on rejected Metal GPU submissions (#3706)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- omlx/utils/metal_sync.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: omlx/eval/humaneval.py omlx/eval/humaneval.py:59— omlx/eval/humaneval.py changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is humaneval._extract_code at line 59), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(eval): place HumanEval body-only answers under the prompt's signature”; “fix(eval): keep code scoring off the event loop (#3635)”; “fix(eval): run accuracy benchmark questions through a worker pool (#3635)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- omlx/eval/humaneval.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: omlx/cluster/memory_guard.py omlx/cluster/memory_guard.py:137— omlx/cluster/memory_guard.py changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is memory_guard._cuda_ceiling_breakdown at line 137), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(cluster): read operator settings without publishing the global singleton (#2835 follow-up)”; “fix(cluster): initialize settings before memory guard fallback (#2835)”; “fix(cluster): correct planner memory accounting for MLA, MTP and local ceilings”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- omlx/cluster/memory_guard.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: omlx/utils/psutil_compat.py omlx/utils/psutil_compat.py:107— omlx/utils/psutil_compat.py changed 3 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is psutil_compat.get_macos_vm_stats at line 107), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(memory-guard): rework tier semantics and prefill accounting (#3933)”; “fix: preserve compressed memory stats with portable count (#2983)”; “fix(macos): use portable vm statistics request count (#3358)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 18:59:31 +09:00' --until='2026-11-04 18:59:31 +09:00' --full-history --no-merges -- omlx/utils/psutil_compat.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.
Duplicated block (12 lines × 2) omlx/adapter/muse_glimmer.py:343— omlx/adapter/muse_glimmer.py:343-354 | omlx/adapter/output_parser.py:1064-1075 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12 lines × 2) omlx/admin/ane_tuning.py:1606— omlx/admin/ane_tuning.py:1606-1617 | omlx/admin/ane_tuning.py:2063-2074 — both copies are in the same file, so extract the 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 `omlx/admin/ane_tuning.py:1606` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) omlx/cluster/registry.py:397— omlx/cluster/registry.py:397-408 | omlx/cluster/registry.py:420-431 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2) omlx/engine/vlm.py:1342— omlx/engine/vlm.py:1342-1353 | omlx/models/vlm.py:380-391 — 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 (12 lines × 2) omlx/engine_pool.py:4338— omlx/engine_pool.py:4338-4350 | omlx/engine_pool.py:4375-4386 — both copies are in the same file, so extract the 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 `omlx/engine_pool.py:4338` 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) omlx/engine_pool.py:4481— omlx/engine_pool.py:4481-4494 | omlx/engine_pool.py:4543-4554 — both copies are in the same file, so extract the 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 `omlx/engine_pool.py:4481` 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) omlx/oq.py:3727— omlx/oq.py:3727-3738 | omlx/oq.py:3809-3820 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12 lines × 2) omlx/patches/bailing_hybrid/bailing_hybrid_model.py:307— omlx/patches/bailing_hybrid/bailing_hybrid_model.py:307-318 | omlx/patches/glm_moe_dsa/glm_moe_dsa_model.py:397-408 — 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 (12 lines × 2) omlx/patches/deepseek_v4/deepseek_v4_model.py:1790— omlx/patches/deepseek_v4/deepseek_v4_model.py:1790-1801 | omlx/patches/deepseek_v4/deepseek_v4_model.py:1961-1972 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2) omlx/patches/minimax_m3/generate_patch.py:34— omlx/patches/minimax_m3/generate_patch.py:34-45 | omlx/scheduler.py:1828-1839 — 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 (12 lines × 2) REDACTED:2388— REDACTED:2388-2399 | REDACTED:309-320 — 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) omlx/patches/qwen35_ane_prefill.py:1226— omlx/patches/qwen35_ane_prefill.py:1226-1237 | omlx/patches/qwen35_ane_prefill.py:1529-1540 — both copies are in the same file, so extract the 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 `omlx/patches/qwen35_ane_prefill.py:1226` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) omlx/patches/qwen35_ane_prefill.py:1684— omlx/patches/qwen35_ane_prefill.py:1684-1696 | omlx/patches/qwen35_ane_prefill.py:2038-2049 — both copies are in the same file, so extract the 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 `omlx/patches/qwen35_ane_prefill.py:1684` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12 lines × 2) omlx/patches/qwen35_gdn_prework.py:1588— omlx/patches/qwen35_gdn_prework.py:1588-1599 | omlx/patches/qwen35_gdn_prework.py:1720-1731 — both copies are in the same file, so extract the 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 `omlx/patches/qwen35_gdn_prework.py:1588` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12 lines × 2) REDACTED:4902— REDACTED:4902-4913 | REDACTED:7874-7885 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2) REDACTED:144— REDACTED:144-155 | omlx/engine/vlm.py:1794-1805 — before extracting anything, compare `REDACTED` and `omlx/engine/vlm.py` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 469 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 (12 lines × 2) apps/omlx-mac/Sources/AppView/AppView.swift:239— apps/omlx-mac/Sources/AppView/AppView.swift:239-250 | apps/omlx-mac/Sources/AppView/Screens/ModelCardSheet.swift:344-355 — 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 (12 lines × 2) apps/omlx-mac/Sources/AppView/Screens/ContextBenchScreen.swift:153— apps/omlx-mac/Sources/AppView/Screens/ContextBenchScreen.swift:153-164 | apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift:122-133 — 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 `apps/omlx-mac/Sources/AppView/Screens/ContextBenchScreen.swift:153` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those 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) apps/omlx-mac/Sources/AppView/Screens/ContextBenchScreen.swift:227— apps/omlx-mac/Sources/AppView/Screens/ContextBenchScreen.swift:227-238 | apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift:936-947 — before extracting anything, compare `apps/omlx-mac/Sources/AppView/Screens/ContextBenchScreen.swift` and `apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 159 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 `apps/omlx-mac/Sources/AppView/Screens/ContextBenchScreen.swift:227` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) apps/omlx-mac/Sources/AppView/Screens/ModelsScreen.swift:112— apps/omlx-mac/Sources/AppView/Screens/ModelsScreen.swift:112-123 | apps/omlx-mac/Sources/AppView/Screens/StatusScreen.swift:536-547 — 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 `apps/omlx-mac/Sources/AppView/Screens/ModelsScreen.swift:112` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) apps/omlx-mac/Sources/AppView/Screens/ModelsScreen.swift:170— apps/omlx-mac/Sources/AppView/Screens/ModelsScreen.swift:170-181 | apps/omlx-mac/Sources/AppView/Screens/StatusScreen.swift:575-586 — 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 `apps/omlx-mac/Sources/AppView/Screens/ModelsScreen.swift:170` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those 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) apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:347— apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:347-358 | apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift:653-664 — 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 `apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:347` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note first that the copies are not typed on the same thing: the declarations holding them bind `spacing` to `0` in one and `6` 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 before the matched lines, `apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift:651` calls `HStack` and `apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:345` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (12 lines × 2) apps/omlx-mac/Sources/Welcome/WelcomeWindow.swift:571— apps/omlx-mac/Sources/Welcome/WelcomeWindow.swift:571-582 | apps/omlx-mac/Sources/Welcome/WelcomeWindow.swift:605-616 — both copies are in the same file, so extract the 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 `apps/omlx-mac/Sources/Welcome/WelcomeWindow.swift:571` 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 first that the copies are not typed on the same thing: the declarations holding them bind `spacing` to `0` in one and `8` 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 (5 lines × 2) omlx/api/decisions.py:170— omlx/api/decisions.py:170-174 | omlx/models/openjev.py:168-172 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `omlx/api/decisions.py:170` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (5 lines × 2) omlx/cache/boundary_snapshot_store.py:1826— omlx/cache/boundary_snapshot_store.py:1826-1830 | omlx/cache/boundary_snapshot_store.py:1853-1857 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) omlx/cache/prefix_cache.py:2148— omlx/cache/prefix_cache.py:2148-2152 | omlx/cache/type_handlers.py:1060-1064 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (5 lines × 2) omlx/cache/prefix_cache.py:2707— omlx/cache/prefix_cache.py:2707-2711 | omlx/cache/prefix_cache.py:3005-3009 — both copies are in the same file, so extract the 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 `omlx/cache/prefix_cache.py:2707` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) omlx/cluster/planner.py:1740— omlx/cluster/planner.py:1740-1744 | omlx/cluster/planner.py:2351-2357 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) omlx/oq.py:6806— omlx/oq.py:6806-6810 | omlx/oq.py:6837-6841 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) omlx/patches/bailing_hybrid/bailing_hybrid_model.py:961— omlx/patches/bailing_hybrid/bailing_hybrid_model.py:961-965 | omlx/patches/glm_moe_dsa/deepseek_v32.py:1026-1030 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (5 lines × 2) omlx/patches/deepseek_v4/moe_offload.py:140— omlx/patches/deepseek_v4/moe_offload.py:140-144 | omlx/patches/glm_moe_dsa/moe_offload.py:175-179 — `omlx/patches/deepseek_v4/moe_offload.py` and `omlx/patches/glm_moe_dsa/moe_offload.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 10 separate duplicated blocks between them, totalling at least 144 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (5 lines × 2) omlx/patches/laguna/laguna_model.py:424— omlx/patches/laguna/laguna_model.py:424-428 | omlx/speculative/dflash/drafter.py:765-769 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `omlx/patches/laguna/laguna_model.py:424` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 2) omlx/patches/m5_gather_qmm_a8.py:1239— omlx/patches/m5_gather_qmm_a8.py:1239-1243 | omlx/patches/m5_gather_qmm_a8.py:1316-1320 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) omlx/patches/m5_gather_qmm_a8.py:1265— omlx/patches/m5_gather_qmm_a8.py:1265-1269 | omlx/patches/m5_gather_qmm_a8.py:1372-1376 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (5 lines × 2) omlx/patches/mlx_vlm_mtp/inkling_vlm_runtime.py:525— omlx/patches/mlx_vlm_mtp/inkling_vlm_runtime.py:525-529 | omlx/patches/mlx_vlm_mtp/inkling_vlm_runtime.py:614-618 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) omlx/patches/moe_expert_offload.py:762— omlx/patches/moe_expert_offload.py:762-766 | omlx/patches/moe_expert_offload.py:830-834 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) omlx/patches/turboquant_attention.py:285— omlx/patches/turboquant_attention.py:285-289 | omlx/patches/turboquant_attention.py:674-678 — both copies are in the same file, so extract the 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 `omlx/patches/turboquant_attention.py:285` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) omlx/cluster/identity.py:38— omlx/cluster/identity.py:38-42 | omlx/cluster/registry.py:208-212 — 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 (5 lines × 2) omlx/patches/deepseek_v4/switch_layers.py:696— omlx/patches/deepseek_v4/switch_layers.py:696-700 | omlx/patches/glm_moe_dsa/switch_layers.py:287-291 — `omlx/patches/deepseek_v4/switch_layers.py` and `omlx/patches/glm_moe_dsa/switch_layers.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 6 separate duplicated blocks between them, totalling at least 75 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (5 lines × 2) omlx/prefill_helper/adapters/minimax_m3.py:155— omlx/prefill_helper/adapters/minimax_m3.py:155-159 | omlx/prefill_helper/adapters/qwen4_exp.py:416-420 — 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 (5 lines × 2) omlx/admin/benchmark.py:605— omlx/admin/benchmark.py:605-609 | omlx/admin/context_benchmark.py:143-147 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `request` to `BenchmarkRequest` in one and `ContextBenchmarkRequest` 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 (5 lines × 2) omlx/patches/deepseek_v4/deepseek_v4_model.py:2363— omlx/patches/deepseek_v4/deepseek_v4_model.py:2363-2367 | omlx/patches/glm_moe_dsa/deepseek_v32.py:830-834 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (5 lines × 2) omlx/patches/specprefill.py:823— omlx/patches/specprefill.py:823-827 | omlx/patches/specprefill.py:867-871 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) apps/omlx-mac/Sources/AppView/Screens/ContextBenchScreen.swift:204— apps/omlx-mac/Sources/AppView/Screens/ContextBenchScreen.swift:204-209 | apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift:333-337 — before extracting anything, compare `apps/omlx-mac/Sources/AppView/Screens/ContextBenchScreen.swift` and `apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 159 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 `apps/omlx-mac/Sources/AppView/Screens/ContextBenchScreen.swift:204` 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 (5 lines × 2) apps/omlx-mac/Sources/AppView/Screens/ProfileViews.swift:830— apps/omlx-mac/Sources/AppView/Screens/ProfileViews.swift:830-834 | apps/omlx-mac/Sources/AppView/Screens/ProfileViews.swift:889-893 — both copies are in the same file, so extract the 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 `apps/omlx-mac/Sources/AppView/Screens/ProfileViews.swift:830` 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.
MethodTooLong: ExperimentalSection.body apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2494— MethodTooLong — body runs 296 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 196 over it, 2.96× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: ModelSettingsScreenVM.save apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:866— MethodTooLong — save runs 208 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 108 over it, 2.08× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: AccelerationSection.body apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2192— MethodTooLong — body runs 170 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 70 over it, 1.70× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: ServerScreen.body apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:17— MethodTooLong — body runs 167 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 67 over it, 1.67× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: AppearanceScreen.body apps/omlx-mac/Sources/AppView/Screens/AppearanceScreen.swift:31— MethodTooLong — body runs 166 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 66 over it, 1.66× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: ServerScreenVM.applyServerSettings apps/omlx-mac/Sources/AppView/ViewModels/ServerScreenVM.swift:241— MethodTooLong — applyServerSettings runs 163 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 63 over it, 1.63× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: MenubarIconRecovery.fixStatusKitPermission apps/omlx-mac/Sources/Menubar/MenubarVisibilityWatcher.swift:368— MethodTooLong — fixStatusKitPermission runs 163 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 63 over it, 1.63× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: LibrarySection.body apps/omlx-mac/Sources/AppView/Screens/ModelsScreen.swift:204— MethodTooLong — body runs 150 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 50 over it, 1.50× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: ModelSettingsScreenVM.load apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:704— MethodTooLong — load runs 141 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 41 over it, 1.41× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: StatusScreen.body apps/omlx-mac/Sources/AppView/Screens/StatusScreen.swift:21— MethodTooLong — body runs 138 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 38 over it, 1.38× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: ExternalEnginesSection.body apps/omlx-mac/Sources/AppView/Screens/IntegrationsScreen.swift:45— MethodTooLong — body runs 136 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 36 over it, 1.36× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: AdvancedPage.body apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1219— MethodTooLong — body runs 130 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 30 over it, 1.30× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: ConfigurationSection.body apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift:177— MethodTooLong — body runs 123 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 23 over it, 1.23× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: SubKeysSection.body apps/omlx-mac/Sources/AppView/Screens/SecurityScreen.swift:282— MethodTooLong — body runs 114 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 14 over it, 1.14× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: ServerDefaultProfileEditor.body apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:492— MethodTooLong — body runs 113 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 13 over it, 1.13× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: WelcomeSetupBody.body apps/omlx-mac/Sources/Welcome/WelcomeWindow.swift:527— MethodTooLong — body runs 113 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 13 over it, 1.13× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: ModelSettingsScreenVM.currentSettingsDict apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:1756— MethodTooLong — currentSettingsDict runs 110 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 10 over it, 1.10× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: AboutSection.aboutContent apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:1266— MethodTooLong — aboutContent runs 109 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 9 over it, 1.09× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: UsageHistoryView.body apps/omlx-mac/Sources/AppView/Screens/UsageHistoryView.swift:16— MethodTooLong — body runs 107 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 7 over it, 1.07× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: PerformanceScreenVM.save apps/omlx-mac/Sources/AppView/ViewModels/PerformanceScreenVM.swift:223— MethodTooLong — save runs 101 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1 over it, 1.01× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: MenubarController.buildMenu apps/omlx-mac/Sources/Menubar/MenubarController.swift:241— MethodTooLong — buildMenu runs 101 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1 over it, 1.01× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
Duplicated block (15 lines × 2) omlx/admin/ane_tuning.py:1225— omlx/admin/ane_tuning.py:1225-1239 | omlx/admin/ane_tuning.py:1305-1319 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (15 lines × 2) REDACTED:2236— REDACTED:2236-2250 | omlx/admin/ms_downloader.py:1015-1029 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (15 lines × 2) omlx/admin/oq_manager.py:479— omlx/admin/oq_manager.py:479-493 | omlx/oq.py:7033-7047 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `omlx/admin/oq_manager.py:479` 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, `omlx/admin/oq_manager.py:477` calls `str` and `omlx/oq.py:7031` 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 (15 lines × 2) omlx/admin/routes.py:8808— omlx/admin/routes.py:8808-8822 | omlx/admin/routes.py:9413-9427 — both copies are in the same file, so extract the 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 `omlx/admin/routes.py:8808` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) omlx/cluster/staging.py:1112— omlx/cluster/staging.py:1112-1126 | omlx/cluster/staging.py:1359-1373 — both copies are in the same file, so extract the 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 `omlx/cluster/staging.py:1112` 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 (15 lines × 2) omlx/cluster/transport.py:995— omlx/cluster/transport.py:995-1009 | omlx/cluster/transport.py:1013-1027 — both copies are in the same file, so extract the 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 `omlx/cluster/transport.py:995` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (15 lines × 2) REDACTED:1211— REDACTED:1211-1225 | omlx/engine/vlm.py:4912-4926 — before extracting anything, compare `REDACTED` and `omlx/engine/vlm.py` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1211` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) REDACTED:1301— REDACTED:1301-1315 | omlx/engine/vlm.py:5036-5050 — before extracting anything, compare `REDACTED` and `omlx/engine/vlm.py` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1301` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) omlx/engine/distributed.py:1226— omlx/engine/distributed.py:1226-1240 | omlx/engine/distributed.py:1341-1355 — both copies are in the same file, so extract the 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 `omlx/engine/distributed.py:1226` 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 (15 lines × 2) omlx/engine/distributed.py:1435— omlx/engine/distributed.py:1435-1449 | omlx/engine/distributed.py:1762-1776 — both copies are in the same file, so extract the 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 `omlx/engine/distributed.py:1435` 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 (15 lines × 2) omlx/oq.py:7651— omlx/oq.py:7651-7665 | omlx/oq.py:11654-11668 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) omlx/oq.py:7864— omlx/oq.py:7864-7878 | omlx/oq.py:11751-11765 — both copies are in the same file, so extract the 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 `omlx/oq.py:7864` 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 (15 lines × 2) omlx/patches/deepseek_v4/chat_template_v4.py:322— omlx/patches/deepseek_v4/chat_template_v4.py:322-336 | omlx/patches/deepseek_v41/encoding.py:590-604 — before extracting anything, compare `omlx/patches/deepseek_v4/chat_template_v4.py` and `omlx/patches/deepseek_v41/encoding.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 210 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (15 lines × 2) omlx/patches/deepseek_v4/deepseek_v4_model.py:647— omlx/patches/deepseek_v4/deepseek_v4_model.py:647-661 | omlx/patches/deepseek_v4/deepseek_v4_model.py:687-701 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) omlx/patches/deepseek_v4/deepseek_v4_model.py:1769— omlx/patches/deepseek_v4/deepseek_v4_model.py:1769-1783 | omlx/patches/deepseek_v4/deepseek_v4_model.py:1940-1954 — both copies are in the same file, so extract the 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 (15 lines × 2) omlx/patches/glm_moe_dsa/moe_offload.py:136— omlx/patches/glm_moe_dsa/moe_offload.py:136-150 | omlx/patches/moe_expert_offload.py:1028-1042 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `omlx/patches/moe_expert_offload.py:1025` calls `getattr`, `tuple` and `omlx/patches/glm_moe_dsa/moe_offload.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 (15 lines × 2) omlx/patches/mlx_lm_mtp/drafter_target.py:80— omlx/patches/mlx_lm_mtp/drafter_target.py:80-94 | omlx/patches/mlx_lm_mtp/qwen35_model.py:536-550 — 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 `omlx/patches/mlx_lm_mtp/drafter_target.py:80` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) omlx/patches/qwen35_ane_prefill.py:698— omlx/patches/qwen35_ane_prefill.py:698-712 | omlx/patches/qwen35_ane_prefill.py:1240-1254 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) REDACTED:4756— REDACTED:4756-4770 | REDACTED:6154-6168 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:4756` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) apps/omlx-mac/Sources/Menubar/MenubarController.swift:661— apps/omlx-mac/Sources/Menubar/MenubarController.swift:661-675 | apps/omlx-mac/Sources/Menubar/MenubarController.swift:695-709 — both copies are in the same file, so extract the 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 `apps/omlx-mac/Sources/Menubar/MenubarController.swift:661` 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 (15 lines × 2) apps/omlx-mac/Sources/Theme/Components/Row.swift:203— apps/omlx-mac/Sources/Theme/Components/Row.swift:203-217 | apps/omlx-mac/Sources/Theme/Components/Row.swift:274-288 — both copies are in the same file, so extract the 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 `apps/omlx-mac/Sources/Theme/Components/Row.swift:203` 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, `apps/omlx-mac/Sources/Theme/Components/Row.swift:273` calls `frame` and `apps/omlx-mac/Sources/Theme/Components/Row.swift:202` 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.
AC6 · Visual & motion safety· Animation without a prefers-reduced-motion guard · ×19
Animation without a prefers-reduced-motion guard apps/omlx-web/omlx_web/templates/chat.html:80— `.message-fade-in` moves (`animation: fadeIn 0.3s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard apps/omlx-web/omlx_web/templates/chat.html:532— `.svg-allow-switch-knob` moves (`transition: transform 0.2s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard apps/omlx-web/omlx_web/templates/chat.html:657— `.thinking-toggle` moves (`transition: transform 0.2s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard apps/omlx-web/omlx_web/templates/chat.html:863— `.composer-switch::after` moves (`transition: transform 0.15s`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard apps/omlx-web/omlx_web/templates/chat.html:897— `.reasoning-slider-fill` moves (`transition: width 0.15s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard apps/omlx-web/omlx_web/templates/dashboard.html— <svg> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
Animation without a prefers-reduced-motion guard apps/omlx-web/omlx_web/templates/dashboard/_bench.html:259— <div> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
Animation without a prefers-reduced-motion guard apps/omlx-web/omlx_web/templates/dashboard/_bench.html:400— <div> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
Animation without a prefers-reduced-motion guard apps/omlx-web/omlx_web/templates/dashboard/_bench_accuracy.html— <svg> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
Animation without a prefers-reduced-motion guard apps/omlx-web/omlx_web/templates/dashboard/_cluster_v2.html:227— <span> moves — its `animate-ping` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
Animation without a prefers-reduced-motion guard apps/omlx-web/omlx_web/templates/dashboard/_cluster_v2.html— <svg> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
Animation without a prefers-reduced-motion guard apps/omlx-web/omlx_web/templates/dashboard/_modal_settings_apply.html— <svg> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
Animation without a prefers-reduced-motion guard apps/omlx-web/omlx_web/templates/dashboard/_models.html:494— <div> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
Animation without a prefers-reduced-motion guard apps/omlx-web/omlx_web/templates/dashboard/_models.html:673— <div> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
Animation without a prefers-reduced-motion guard apps/omlx-web/omlx_web/templates/dashboard/_models.html— <svg> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
Animation without a prefers-reduced-motion guard apps/omlx-web/omlx_web/templates/dashboard/_models.html:2103— <div> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
Animation without a prefers-reduced-motion guard REDACTED:84— <div> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
Animation without a prefers-reduced-motion guard apps/omlx-web/omlx_web/templates/dashboard/_settings.html:1262— <i> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
Animation without a prefers-reduced-motion guard apps/omlx-web/omlx_web/templates/dashboard/_settings.html:1279— <i> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
TooManyMethods: Scheduler omlx/scheduler.py:2170— TooManyMethods — 295 methods. The bar is 30 methods; this is 265 over it, 9.83× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: EnginePool omlx/engine_pool.py:430— TooManyMethods — 116 methods. The bar is 30 methods; this is 86 over it, 3.87× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: OMLXClient apps/omlx-mac/Sources/Net/OMLXClient.swift:38— TooManyMethods — 100 methods. The bar is 30 methods; this is 70 over it, 3.33× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: PagedSSDCacheManager omlx/cache/paged_ssd_cache.py:1742— TooManyMethods — 79 methods. The bar is 30 methods; this is 49 over it, 2.63× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: BlockAwarePrefixCache omlx/cache/prefix_cache.py:244— TooManyMethods — 65 methods. The bar is 30 methods; this is 35 over it, 2.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: MenubarController apps/omlx-mac/Sources/Menubar/MenubarController.swift:26— TooManyMethods — 64 methods. The bar is 30 methods; this is 34 over it, 2.13× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: ProcessMemoryEnforcer omlx/process_memory_enforcer.py:401— TooManyMethods — 63 methods. The bar is 30 methods; this is 33 over it, 2.10× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: ModelSettingsScreenVM apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:34— TooManyMethods — 58 methods. The bar is 30 methods; this is 28 over it, 1.93× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: VLMBatchedEngine omlx/engine/vlm.py:1706— TooManyMethods — 55 methods. The bar is 30 methods; this is 25 over it, 1.83× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: ModelSettingsManager omlx/model_settings.py:697— TooManyMethods — 49 methods. The bar is 30 methods; this is 19 over it, 1.63× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: DistributedBatchedEngine omlx/engine/distributed.py:204— TooManyMethods — 45 methods. The bar is 30 methods; this is 15 over it, 1.50× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: TalkAIController apps/omlx-mac/Sources/AskAI/TalkAIController.swift:12— TooManyMethods — 44 methods. The bar is 30 methods; this is 14 over it, 1.47× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: BoundarySnapshotSSDStore omlx/cache/boundary_snapshot_store.py:119— TooManyMethods — 40 methods. The bar is 30 methods; this is 10 over it, 1.33× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: RuntimeTelemetry omlx/cluster/telemetry.py:135— TooManyMethods — 37 methods. The bar is 30 methods; this is 7 over it, 1.23× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: DiscoveryService REDACTED:1159— TooManyMethods — 34 methods. The bar is 30 methods; this is 4 over it, 1.13× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: AskAIController apps/omlx-mac/Sources/AskAI/AskAIController.swift:9— TooManyMethods — 33 methods. The bar is 30 methods; this is 3 over it, 1.10× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: SplashEngine REDACTED:1197— TooManyMethods — 32 methods. The bar is 30 methods; this is 2 over it, 1.07× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: MLXRerankerModel omlx/models/reranker.py:69— TooManyMethods — 31 methods. The bar is 30 methods; this is 1 over it, 1.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: VLMModelAdapter omlx/models/vlm.py:80— TooManyMethods — 31 methods. The bar is 30 methods; this is 1 over it, 1.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
Duplicated block (6 lines × 2) omlx/admin/oq_manager.py:363— omlx/admin/oq_manager.py:363-368 | omlx/admin/oq_manager.py:398-404 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) omlx/admin/routes.py:2682— omlx/admin/routes.py:2682-2687 | REDACTED:4032-4037 — 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) omlx/engine/distributed.py:1944— omlx/engine/distributed.py:1944-1951 | omlx/engine/distributed.py:1989-1994 — both copies are in the same file, so extract the 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 `omlx/engine/distributed.py:1944` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (6 lines × 2) omlx/model_settings.py:1211— omlx/model_settings.py:1211-1216 | omlx/model_settings.py:1819-1824 — both copies are in the same file, so extract the 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 `omlx/model_settings.py:1211` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) omlx/oq.py:1056— omlx/oq.py:1056-1061 | omlx/oq.py:8914-8919 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 2) omlx/patches/deepseek_v4/switch_layers.py:469— omlx/patches/deepseek_v4/switch_layers.py:469-474 | omlx/patches/glm_moe_dsa/switch_layers.py:192-197 — `omlx/patches/deepseek_v4/switch_layers.py` and `omlx/patches/glm_moe_dsa/switch_layers.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 6 separate duplicated blocks between them, totalling at least 75 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (6 lines × 2) omlx/patches/glm_moe_dsa/deepseek_v32.py:499— omlx/patches/glm_moe_dsa/deepseek_v32.py:499-504 | omlx/patches/glm_moe_dsa/glm_moe_dsa_model.py:192-197 — 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) omlx/patches/qwen35_moe_routed_decode.py:465— omlx/patches/qwen35_moe_routed_decode.py:465-470 | omlx/patches/qwen35_moe_routed_decode.py:562-567 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `omlx/patches/qwen35_moe_routed_decode.py:465` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 2) omlx/patches/qwen35_oq_a8.py:491— omlx/patches/qwen35_oq_a8.py:491-496 | omlx/patches/qwen35_q4_mlp.py:278-283 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 2) omlx/patches/raon1_mini/raon1_mini_model.py:178— omlx/patches/raon1_mini/raon1_mini_model.py:178-183 | omlx/patches/raon1_mini/raon1_mini_model.py:589-596 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) omlx/patches/raon1_mini/raon1_mini_model.py:1810— omlx/patches/raon1_mini/raon1_mini_model.py:1810-1815 | omlx/patches/raon1_mini/raon1_mini_model.py:1836-1841 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) omlx/adapter/gemma4.py:296— omlx/adapter/gemma4.py:296-301 | omlx/api/tool_calling.py:3229-3234 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 2) omlx/eval/cmmlu.py:27— omlx/eval/cmmlu.py:27-32 | omlx/eval/jmmlu.py:27-32 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (6 lines × 2) omlx/patches/mlx_lm_mtp/glm_moe_dsa_model.py:251— omlx/patches/mlx_lm_mtp/glm_moe_dsa_model.py:251-256 | omlx/patches/mlx_vlm_mtp/glm5_next_vlm_runtime.py:199-204 — 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) apps/omlx-mac/Sources/AppView/Screens/DownloadsScreen.swift:645— apps/omlx-mac/Sources/AppView/Screens/DownloadsScreen.swift:645-650 | apps/omlx-mac/Sources/AppView/Screens/DownloadsScreen.swift:764-769 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) apps/omlx-mac/Sources/AppView/Screens/IntegrationsScreen.swift:137— apps/omlx-mac/Sources/AppView/Screens/IntegrationsScreen.swift:137-142 | apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:748-756 — 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 `apps/omlx-mac/Sources/AppView/Screens/IntegrationsScreen.swift:137` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (6 lines × 2) apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:297— apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:297-302 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:352-357 — both copies are in the same file, so extract the 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 `apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:297` 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) apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1180— apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1180-1185 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1192-1197 — both copies are in the same file, so extract the 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 `apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1180` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1625— apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1625-1630 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1662-1667 — both copies are in the same file, so extract the 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 `apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1625` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) omlx/adapter/gemma4.py:144— omlx/adapter/gemma4.py:144-154 | omlx/adapter/gemma4.py:235-245 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) REDACTED:1824— REDACTED:1824-1834 | omlx/admin/ms_downloader.py:765-775 — 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 (11 lines × 2) REDACTED:1865— REDACTED:1865-1875 | omlx/admin/ms_downloader.py:803-813 — 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 (11 lines × 2) omlx/admin/routes.py:3787— omlx/admin/routes.py:3787-3797 | omlx/admin/routes.py:3837-3847 — both copies are in the same file, so extract the 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 `omlx/admin/routes.py:3787` 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 (11 lines × 2) omlx/cache/paged_ssd_cache.py:5378— omlx/cache/paged_ssd_cache.py:5378-5388 | omlx/cache/paged_ssd_cache.py:5464-5474 — both copies are in the same file, so extract the 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 `omlx/cache/paged_ssd_cache.py:5378` 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 (11 lines × 2) omlx/cluster/runtime.py:562— omlx/cluster/runtime.py:562-572 | omlx/cluster/runtime.py:580-590 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) REDACTED:727— REDACTED:727-737 | REDACTED:896-906 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) REDACTED:2249— REDACTED:2249-2259 | omlx/scheduler.py:16650-16660 — 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 `REDACTED:2249` 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 (11 lines × 2) omlx/oq.py:11296— omlx/oq.py:11296-11306 | omlx/oq.py:12058-12068 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) omlx/patches/deepseek_v4/cache_handlers.py:128— omlx/patches/deepseek_v4/cache_handlers.py:128-140 | omlx/patches/deepseek_v4/cache_handlers.py:260-270 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) omlx/patches/qwen35_ane_prefill.py:1143— omlx/patches/qwen35_ane_prefill.py:1143-1153 | omlx/patches/qwen35_ane_prefill.py:1389-1399 — both copies are in the same file, so extract the 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 `omlx/patches/qwen35_ane_prefill.py:1143` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) omlx/patches/qwen35_q4_mlp.py:566— omlx/patches/qwen35_q4_mlp.py:566-576 | omlx/patches/qwen35_q4_mlp.py:648-658 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) omlx/scheduler.py:4442— omlx/scheduler.py:4442-4452 | omlx/scheduler.py:6750-6760 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) REDACTED:8310— REDACTED:8310-8321 | REDACTED:8469-8479 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) omlx/cluster/launch.py:283— omlx/cluster/launch.py:283-293 | omlx/cluster/liveness.py:260-274 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) REDACTED:116— REDACTED:116-126 | omlx/engine/vlm.py:1768-1778 — before extracting anything, compare `REDACTED` and `omlx/engine/vlm.py` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 2) omlx/cluster/enrollment.py:319— omlx/cluster/enrollment.py:319-329 | REDACTED:435-445 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:2472— apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:2472-2482 | apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:2511-2521 — both copies are in the same file, so extract the 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 `apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:2472` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) omlx/adapter/gemma4.py:41— omlx/adapter/gemma4.py:41-50 | omlx/api/responses_utils.py:38-47 — 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 (10 lines × 2) omlx/cluster/identity.py:112— omlx/cluster/identity.py:112-121 | omlx/cluster/registry.py:270-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 both call sites, so a change lands once.
Duplicated block (10 lines × 2) REDACTED:1627— REDACTED:1627-1636 | REDACTED:1681-1690 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1627` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) omlx/patches/bailing_hybrid/__init__.py:48— omlx/patches/bailing_hybrid/__init__.py:48-57 | omlx/patches/raon1_mini/__init__.py:49-58 — 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) omlx/patches/deepseek_v4/moe_offload.py:246— omlx/patches/deepseek_v4/moe_offload.py:246-255 | omlx/patches/glm_moe_dsa/moe_offload.py:296-305 — `omlx/patches/deepseek_v4/moe_offload.py` and `omlx/patches/glm_moe_dsa/moe_offload.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 10 separate duplicated blocks between them, totalling at least 144 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (10 lines × 2) omlx/patches/deepseek_v4/switch_layers.py:394— omlx/patches/deepseek_v4/switch_layers.py:394-403 | omlx/patches/glm_moe_dsa/switch_layers.py:118-127 — `omlx/patches/deepseek_v4/switch_layers.py` and `omlx/patches/glm_moe_dsa/switch_layers.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 6 separate duplicated blocks between them, totalling at least 75 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (10 lines × 2) omlx/patches/glm53_kda_prework.py:231— omlx/patches/glm53_kda_prework.py:231-240 | omlx/patches/qwen35_gdn_prework.py:970-979 — 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 `omlx/patches/glm53_kda_prework.py:231` 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 (10 lines × 2) omlx/patches/mlx_lm_mtp/deepseek_v4_model.py:361— omlx/patches/mlx_lm_mtp/deepseek_v4_model.py:361-370 | omlx/patches/mlx_lm_mtp/deepseek_v4_model.py:395-404 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) omlx/patches/qwen35_ane_prefill.py:1235— omlx/patches/qwen35_ane_prefill.py:1235-1244 | omlx/patches/qwen35_ane_prefill.py:1457-1466 — both copies are in the same file, so extract the 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 `omlx/patches/qwen35_ane_prefill.py:1235` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) omlx/patches/qwen35_verify_sdpa_split.py:381— omlx/patches/qwen35_verify_sdpa_split.py:381-390 | omlx/patches/qwen35_verify_sdpa_split.py:635-644 — both copies are in the same file, so extract the 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 `omlx/patches/qwen35_verify_sdpa_split.py:381` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) omlx/scheduler.py:4127— omlx/scheduler.py:4127-4136 | omlx/scheduler.py:4178-4187 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:706— apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:706-715 | apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:1083-1092 — both copies are in the same file, so extract the 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 `apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:706` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) apps/omlx-mac/Sources/AppView/Screens/ContextBenchScreen.swift:138— apps/omlx-mac/Sources/AppView/Screens/ContextBenchScreen.swift:138-148 | apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift:218-227 — before extracting anything, compare `apps/omlx-mac/Sources/AppView/Screens/ContextBenchScreen.swift` and `apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 159 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 `apps/omlx-mac/Sources/AppView/Screens/ContextBenchScreen.swift:138` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (10 lines × 2) apps/omlx-mac/Sources/AppView/Screens/IntegrationsScreen.swift:580— apps/omlx-mac/Sources/AppView/Screens/IntegrationsScreen.swift:580-589 | apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:118-127 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `apps/omlx-mac/Sources/AppView/Screens/IntegrationsScreen.swift:580` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) apps/omlx-mac/Sources/AppView/Screens/SecurityScreen.swift:226— apps/omlx-mac/Sources/AppView/Screens/SecurityScreen.swift:226-236 | apps/omlx-mac/Sources/AppView/Screens/StatusScreen.swift:655-664 — 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 `apps/omlx-mac/Sources/AppView/Screens/SecurityScreen.swift:226` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) apps/omlx-mac/Sources/AppView/ViewModels/ServerScreenVM.swift:124— apps/omlx-mac/Sources/AppView/ViewModels/ServerScreenVM.swift:124-133 | apps/omlx-mac/Sources/AppView/ViewModels/ServerScreenVM.swift:176-185 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Focus outline removed inline apps/omlx-web/omlx_web/templates/chat.html:1220— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline apps/omlx-web/omlx_web/templates/chat.html:1284— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline apps/omlx-web/omlx_web/templates/chat.html:2135— <select> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline apps/omlx-web/omlx_web/templates/chat.html:2494— <textarea> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline apps/omlx-web/omlx_web/templates/chat.html:2566— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline apps/omlx-web/omlx_web/templates/chat.html:2575— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline apps/omlx-web/omlx_web/templates/chat.html:2629— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline apps/omlx-web/omlx_web/templates/chat.html:2727— <select> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline apps/omlx-web/omlx_web/templates/dashboard/_bench.html:381— <textarea> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline apps/omlx-web/omlx_web/templates/dashboard/_bench_accuracy.html:537— <textarea> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline apps/omlx-web/omlx_web/templates/dashboard/_logs.html:64— <button> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline apps/omlx-web/omlx_web/templates/dashboard/_logs.html:103— <textarea> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline apps/omlx-web/omlx_web/templates/dashboard/_settings.html:563— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline apps/omlx-web/omlx_web/templates/dashboard/_settings.html:606— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Duplicated block (13 lines × 2) omlx/adapter/muse_glimmer.py:357— omlx/adapter/muse_glimmer.py:357-369 | omlx/adapter/output_parser.py:1078-1090 — 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 (13 lines × 2) omlx/cache/paged_ssd_cache.py:2156— omlx/cache/paged_ssd_cache.py:2156-2168 | omlx/cache/paged_ssd_cache.py:3947-3959 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) omlx/cluster/collective.py:241— omlx/cluster/collective.py:241-253 | omlx/cluster/collective.py:335-347 — both copies are in the same file, so extract the 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 `omlx/cluster/collective.py:241` 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 `rank` to `"MLX collective did not return one result from each rank" + suffix ) for` in one and `"pipeline smoke did not return one result from each rank" + suffix ) for` 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 (13 lines × 2) omlx/cluster/identity.py:143— omlx/cluster/identity.py:143-155 | REDACTED:233-245 — 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 `omlx/cluster/identity.py:143` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) omlx/engine/sts.py:327— omlx/engine/sts.py:327-339 | REDACTED:684-696 — 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 (13 lines × 2) REDACTED:986— REDACTED:986-998 | REDACTED:1075-1087 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) omlx/engine/vlm.py:3874— omlx/engine/vlm.py:3874-3886 | omlx/engine/vlm.py:3902-3914 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13 lines × 2) omlx/patches/deepseek_v4/deepseek_v4_model.py:1753— omlx/patches/deepseek_v4/deepseek_v4_model.py:1753-1765 | omlx/patches/deepseek_v4/deepseek_v4_model.py:2175-2187 — both copies are in the same file, so extract the 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 `omlx/patches/deepseek_v4/deepseek_v4_model.py:1753` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) omlx/patches/deepseek_v4/moe_offload.py:221— omlx/patches/deepseek_v4/moe_offload.py:221-233 | omlx/patches/glm_moe_dsa/moe_offload.py:271-283 — `omlx/patches/deepseek_v4/moe_offload.py` and `omlx/patches/glm_moe_dsa/moe_offload.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 10 separate duplicated blocks between them, totalling at least 144 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (13 lines × 2) omlx/patches/qwen35_ane_prefill.py:536— omlx/patches/qwen35_ane_prefill.py:536-548 | omlx/patches/qwen35_ane_prefill.py:1532-1544 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) omlx/patches/turboquant_attention.py:1012— omlx/patches/turboquant_attention.py:1012-1024 | omlx/patches/turboquant_attention.py:1107-1119 — both copies are in the same file, so extract the 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 `omlx/patches/turboquant_attention.py:1012` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13 lines × 2) omlx/scheduler.py:11136— omlx/scheduler.py:11136-11148 | omlx/scheduler.py:11166-11178 — both copies are in the same file, so extract the 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 `omlx/scheduler.py:11136` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:490— apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:490-502 | apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:837-849 — both copies are in the same file, so extract the 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 `apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:490` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) omlx/cache/boundary_snapshot_store.py:1875— omlx/cache/boundary_snapshot_store.py:1875-1882 | omlx/cache/boundary_snapshot_store.py:1883-1890 — both copies are in the same file, so extract the 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) omlx/model_discovery.py:1033— omlx/model_discovery.py:1033-1040 | omlx/model_discovery.py:1055-1062 — both copies are in the same file, so extract the 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) omlx/patches/k2_horizon/k2_horizon_model.py:323— omlx/patches/k2_horizon/k2_horizon_model.py:323-330 | omlx/patches/laguna/laguna_model.py:428-435 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `omlx/patches/k2_horizon/k2_horizon_model.py:323` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) omlx/patches/mlx_lm_mtp/deepseek_v4_model.py:642— omlx/patches/mlx_lm_mtp/deepseek_v4_model.py:642-649 | omlx/patches/mlx_vlm_mtp/glm5_next_vlm_runtime.py:979-986 — 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) omlx/patches/qwen35_verify_qmm.py:252— omlx/patches/qwen35_verify_qmm.py:252-259 | omlx/patches/qwen35_verify_qmm.py:400-407 — both copies are in the same file, so extract the 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 (8 lines × 2) omlx/scheduler.py:1739— omlx/scheduler.py:1739-1746 | omlx/scheduler.py:1754-1761 — both copies are in the same file, so extract the 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) omlx/utils/nax_attention.py:899— omlx/utils/nax_attention.py:899-906 | omlx/utils/nax_attention.py:929-937 — both copies are in the same file, so extract the 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) omlx/integrations/codex.py:364— omlx/integrations/codex.py:364-372 | omlx/integrations/copilot.py:108-115 — 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) apps/omlx-mac/Sources/AppView/Screens/AccuracyBenchScreen.swift:699— apps/omlx-mac/Sources/AppView/Screens/AccuracyBenchScreen.swift:699-706 | apps/omlx-mac/Sources/AppView/Screens/AccuracyBenchScreen.swift:890-897 — both copies are in the same file, so extract the 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 `apps/omlx-mac/Sources/AppView/Screens/AccuracyBenchScreen.swift:699` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (8 lines × 2) apps/omlx-mac/Sources/AppView/Screens/DownloadsScreen.swift:848— apps/omlx-mac/Sources/AppView/Screens/DownloadsScreen.swift:848-855 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:390-397 — 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: the declarations holding them bind `spacing` to `6` in one and `10` 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, `apps/omlx-mac/Sources/AppView/Screens/DownloadsScreen.swift:856` calls `frame` and `apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:398` 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 × 2) apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1171— apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1171-1178 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1183-1190 — both copies are in the same file, so extract the 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 `apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1171` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1180` calls `disabled`, `help` and `apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1169` 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 × 2) apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1256— apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1256-1263 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1297-1304 — both copies are in the same file, so extract the 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 `apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1256` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1706— apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1706-1713 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1728-1735 — both copies are in the same file, so extract the 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 `apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1706` 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.
X15 · Unvalidated length from an untrusted reader· Length read from the parsed input is spent without ever being bounded · ×13
Length read from the parsed input is spent without ever being bounded omlx/oq.py:2466— `header_len` is read from the bytes being parsed at line 2465 (`int.from_bytes(… 8 bytes …)`), then passed as the size of `read` at line 2466 — and nowhere in its function is `header_len` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: the call reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB (a 64-bit one for more than any machine has), and the reservation either raises `MemoryError` out of a parser whose failure path was written for malformed input, not for hostile input, or succeeds and holds gigabytes for a few bytes on the wire. Bound `header_len` against the bytes actually remaining and a maximum the format allows before reading.
Length read from the parsed input is spent without ever being bounded omlx/oq.py:2500— `header_len` is read from the bytes being parsed at line 2499 (`int.from_bytes(… 8 bytes …)`), then passed as the size of `read` at line 2500 — and nowhere in its function is `header_len` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: the call reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB (a 64-bit one for more than any machine has), and the reservation either raises `MemoryError` out of a parser whose failure path was written for malformed input, not for hostile input, or succeeds and holds gigabytes for a few bytes on the wire. Bound `header_len` against the bytes actually remaining and a maximum the format allows before reading.
Length read from the parsed input is spent without ever being bounded omlx/utils/model_loading.py:1575— `header_len` is read from the bytes being parsed at line 1574 (`int.from_bytes(… 8 bytes …)`), then passed as the size of `read` at line 1575 — and nowhere in its function is `header_len` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: the call reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB (a 64-bit one for more than any machine has), and the reservation either raises `MemoryError` out of a parser whose failure path was written for malformed input, not for hostile input, or succeeds and holds gigabytes for a few bytes on the wire. Bound `header_len` against the bytes actually remaining and a maximum the format allows before reading.
Length read from the parsed input is spent without ever being bounded omlx/prefill_helper/adapter.py:48— `length` is read from the bytes being parsed at line 47 (`struct.unpack("<Q")`), then passed as the size of `read` at line 48 — and nowhere in its function is `length` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: the call reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB (a 64-bit one for more than any machine has), and the reservation either raises `MemoryError` out of a parser whose failure path was written for malformed input, not for hostile input, or succeeds and holds gigabytes for a few bytes on the wire. Bound `length` against the bytes actually remaining and a maximum the format allows before reading.
Length read from the parsed input is spent without ever being bounded omlx/patches/moe_expert_offload.py:124— `header_len` is read from the bytes being parsed at line 123 (`struct.unpack("<Q")`), then passed as the size of `read` at line 124 — and nowhere in its function is `header_len` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: the call reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB (a 64-bit one for more than any machine has), and the reservation either raises `MemoryError` out of a parser whose failure path was written for malformed input, not for hostile input, or succeeds and holds gigabytes for a few bytes on the wire. Bound `header_len` against the bytes actually remaining and a maximum the format allows before reading.
Length read from the parsed input is spent without ever being bounded omlx/patches/moe_expert_offload.py:1223— `header_len` is read from the bytes being parsed at line 1222 (`struct.unpack("<Q")`), then passed as the size of `read` at line 1223 — and nowhere in its function is `header_len` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: the call reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB (a 64-bit one for more than any machine has), and the reservation either raises `MemoryError` out of a parser whose failure path was written for malformed input, not for hostile input, or succeeds and holds gigabytes for a few bytes on the wire. Bound `header_len` against the bytes actually remaining and a maximum the format allows before reading.
Length read from the parsed input is spent without ever being bounded omlx/patches/muse_spark/model.py:214— `size` is read from the bytes being parsed at line 213 (`struct.unpack("<Q")`), then passed as the size of `read` at line 214 — and nowhere in its function is `size` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: the call reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB (a 64-bit one for more than any machine has), and the reservation either raises `MemoryError` out of a parser whose failure path was written for malformed input, not for hostile input, or succeeds and holds gigabytes for a few bytes on the wire. Bound `size` against the bytes actually remaining and a maximum the format allows before reading.
Length read from the parsed input is spent without ever being bounded omlx/patches/mlx_vlm_qwen4_exp_compat/residency.py:43— `header_size` is read from the bytes being parsed at line 42 (`struct.unpack("<Q")`), then passed as the size of `read` at line 43 — and nowhere in its function is `header_size` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: the call reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB (a 64-bit one for more than any machine has), and the reservation either raises `MemoryError` out of a parser whose failure path was written for malformed input, not for hostile input, or succeeds and holds gigabytes for a few bytes on the wire. Bound `header_size` against the bytes actually remaining and a maximum the format allows before reading.
Length read from the parsed input is spent without ever being bounded omlx/patches/deepseek_v41/oq.py:120— `size` is read from the bytes being parsed at line 119 (`struct.unpack("<Q")`), then passed as the size of `read` at line 120 — and nowhere in its function is `size` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: the call reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB (a 64-bit one for more than any machine has), and the reservation either raises `MemoryError` out of a parser whose failure path was written for malformed input, not for hostile input, or succeeds and holds gigabytes for a few bytes on the wire. Bound `size` against the bytes actually remaining and a maximum the format allows before reading.
Length read from the parsed input is spent without ever being bounded omlx/patches/deepseek_v41/oq.py:291— `size` is read from the bytes being parsed at line 290 (`struct.unpack("<Q")`), then passed as the size of `read` at line 291 — and nowhere in its function is `size` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: the call reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB (a 64-bit one for more than any machine has), and the reservation either raises `MemoryError` out of a parser whose failure path was written for malformed input, not for hostile input, or succeeds and holds gigabytes for a few bytes on the wire. Bound `size` against the bytes actually remaining and a maximum the format allows before reading.
Length read from the parsed input is spent without ever being bounded omlx/patches/deepseek_v41/oq_inventory.py:19— `length` is read from the bytes being parsed at line 18 (`struct.unpack("<Q")`), then passed as the size of `read` at line 19 — and nowhere in its function is `length` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: the call reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB (a 64-bit one for more than any machine has), and the reservation either raises `MemoryError` out of a parser whose failure path was written for malformed input, not for hostile input, or succeeds and holds gigabytes for a few bytes on the wire. Bound `length` against the bytes actually remaining and a maximum the format allows before reading.
Length read from the parsed input is spent without ever being bounded omlx/patches/deepseek_v41/storage.py:141— `length` is read from the bytes being parsed at line 140 (`struct.unpack("<Q")`), then passed as the size of `read` at line 141 — and nowhere in its function is `length` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: the call reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB (a 64-bit one for more than any machine has), and the reservation either raises `MemoryError` out of a parser whose failure path was written for malformed input, not for hostile input, or succeeds and holds gigabytes for a few bytes on the wire. Bound `length` against the bytes actually remaining and a maximum the format allows before reading.
Length read from the parsed input is spent without ever being bounded omlx/admin/hf_uploader.py:116— `size` is read from the bytes being parsed at line 115 (`struct.unpack("<Q")`), then passed as the size of `read` at line 116 — and nowhere in its function is `size` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: the call reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB (a 64-bit one for more than any machine has), and the reservation either raises `MemoryError` out of a parser whose failure path was written for malformed input, not for hostile input, or succeeds and holds gigabytes for a few bytes on the wire. Bound `size` against the bytes actually remaining and a maximum the format allows before reading.
Duplicated block (14 lines × 2) omlx/admin/ane_tuning.py:1540— omlx/admin/ane_tuning.py:1540-1553 | omlx/admin/ane_tuning.py:2041-2054 — both copies are in the same file, so extract the 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 `omlx/admin/ane_tuning.py:1540` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) omlx/api/anthropic_utils.py:296— omlx/api/anthropic_utils.py:296-309 | omlx/api/anthropic_utils.py:431-444 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2) omlx/api/audio_routes.py:554— omlx/api/audio_routes.py:554-567 | omlx/api/audio_routes.py:1653-1666 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2) omlx/cluster/collective.py:66— omlx/cluster/collective.py:66-79 | omlx/cluster/launch.py:1388-1401 — 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 `omlx/cluster/collective.py:66` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) omlx/engine/distributed.py:1587— omlx/engine/distributed.py:1587-1600 | omlx/engine/distributed.py:1674-1687 — both copies are in the same file, so extract the 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 `omlx/engine/distributed.py:1587` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) REDACTED:1415— REDACTED:1415-1431 | REDACTED:1507-1520 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1415` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) omlx/patches/deepseek_v4/moe_offload.py:270— omlx/patches/deepseek_v4/moe_offload.py:270-283 | omlx/patches/glm_moe_dsa/moe_offload.py:320-333 — `omlx/patches/deepseek_v4/moe_offload.py` and `omlx/patches/glm_moe_dsa/moe_offload.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 10 separate duplicated blocks between them, totalling at least 144 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (14 lines × 2) omlx/patches/deepseek_v4/switch_layers.py:706— omlx/patches/deepseek_v4/switch_layers.py:706-719 | omlx/patches/glm_moe_dsa/switch_layers.py:299-312 — `omlx/patches/deepseek_v4/switch_layers.py` and `omlx/patches/glm_moe_dsa/switch_layers.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 6 separate duplicated blocks between them, totalling at least 75 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (14 lines × 2) omlx/patches/mlx_vlm_inkling_compat/__init__.py:101— omlx/patches/mlx_vlm_inkling_compat/__init__.py:101-114 | omlx/patches/mlx_vlm_unlimited_ocr_compat/__init__.py:41-54 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (14 lines × 2) omlx/scheduler.py:15126— omlx/scheduler.py:15126-15139 | omlx/scheduler.py:15400-15413 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `request` to `Request` in one and `"Request"` 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 (14 lines × 2) apps/omlx-mac/Sources/AppView/Screens/ContextBenchScreen.swift:377— apps/omlx-mac/Sources/AppView/Screens/ContextBenchScreen.swift:377-390 | apps/omlx-mac/Sources/AppView/ViewModels/PerformanceScreenVM.swift:417-430 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `apps/omlx-mac/Sources/AppView/Screens/ContextBenchScreen.swift:377` 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.
Swallowed exception (empty catch) omlx/_torch_stub.py:401— 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) omlx/_torch_stub.py:412— 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) REDACTED:566— 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) omlx/engine_pool.py:4343— 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) omlx/engine_pool.py:4379— 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) REDACTED:2220— 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) omlx/oq.py:6060— 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) omlx/oq.py:6071— 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) omlx/oq.py:6083— 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) omlx/oq.py:8215— 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.
Duplicated block (10 lines × 3) omlx/api/audio_routes.py:560— omlx/api/audio_routes.py:560-569 | omlx/api/audio_routes.py:1559-1568 | omlx/api/audio_routes.py:1659-1668 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 3) omlx/cluster/transport.py:211— omlx/cluster/transport.py:211-220 | omlx/cluster/transport.py:595-604 | omlx/cluster/transport.py:642-651 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 3) omlx/patches/deepseek_v4/deepseek_v4_model.py:1686— omlx/patches/deepseek_v4/deepseek_v4_model.py:1686-1695 | omlx/patches/deepseek_v4/deepseek_v4_model.py:1796-1805 | omlx/patches/deepseek_v4/deepseek_v4_model.py:1967-1976 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `omlx/patches/deepseek_v4/deepseek_v4_model.py:1686` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 3) omlx/patches/deepseek_v4/deepseek_v4_model.py:2501— omlx/patches/deepseek_v4/deepseek_v4_model.py:2501-2510 | omlx/patches/mlx_lm_mtp/deepseek_v4_model.py:829-838 | omlx/patches/mlx_lm_mtp/deepseek_v4_model.py:882-891 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `omlx/patches/deepseek_v4/deepseek_v4_model.py:2501` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 3) omlx/patches/deepseek_v4/moe_offload.py:312— omlx/patches/deepseek_v4/moe_offload.py:312-321 | omlx/patches/glm_moe_dsa/moe_offload.py:357-366 | omlx/patches/moe_expert_offload.py:956-965 — `omlx/patches/deepseek_v4/moe_offload.py` and `omlx/patches/glm_moe_dsa/moe_offload.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 10 separate duplicated blocks between them, totalling at least 144 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 3) omlx/patches/mlx_lm_mtp/qwen35_model.py:268— omlx/patches/mlx_lm_mtp/qwen35_model.py:268-277 | omlx/patches/qwen35_q4_mlp.py:423-432 | omlx/patches/qwen35_q4_mlp.py:733-742 — 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 (10 lines × 3) apps/omlx-mac/Sources/AppView/Screens/AccuracyBenchScreen.swift:808— apps/omlx-mac/Sources/AppView/Screens/AccuracyBenchScreen.swift:808-817 | apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:744-753 | apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift:867-876 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (10 lines × 3) apps/omlx-mac/Sources/AppView/Screens/AppearanceScreen.swift:252— apps/omlx-mac/Sources/AppView/Screens/AppearanceScreen.swift:252-265 | apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:81-90 | apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:135-144 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/omlx-mac/Sources/AppView/Screens/AppearanceScreen.swift:252` 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 first that the copies are not typed on the same thing: the declarations holding them bind `label` to `String(localized: "server.row.listen_address", defaultValue: "Listen Address", comment: "Row label for the listen-address picker in Server screen")` in one and `String(localized: "server.row.log_level", defaultValue: "Log Level", comment: "Row label for the log level picker")` 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 before the matched lines, `apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:134` calls `id` and `apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:80` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 3) apps/omlx-mac/Sources/AppView/Screens/DownloadsScreen.swift:251— apps/omlx-mac/Sources/AppView/Screens/DownloadsScreen.swift:251-260 | apps/omlx-mac/Sources/AppView/Screens/DownloadsScreen.swift:407-416 | apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift:899-908 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/omlx-mac/Sources/AppView/Screens/DownloadsScreen.swift:251` 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 first that the copies are not typed on the same thing: the declarations holding them bind `spacing` to `8` in one and `10` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (16 lines × 2) omlx/api/anthropic_utils.py:234— omlx/api/anthropic_utils.py:234-249 | omlx/api/anthropic_utils.py:503-518 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 2) omlx/cluster/launch.py:1818— omlx/cluster/launch.py:1818-1833 | omlx/cluster/launch.py:1857-1872 — both copies are in the same file, so extract the 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 `omlx/cluster/launch.py:1818` 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 (16 lines × 2) omlx/cluster/tensor_strategies.py:392— omlx/cluster/tensor_strategies.py:392-407 | omlx/cluster/tensor_strategies.py:585-600 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 2) omlx/cluster/transport.py:201— omlx/cluster/transport.py:201-216 | omlx/cluster/transport.py:632-647 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 2) omlx/patches/m5_gather_qmm_nax.py:1642— omlx/patches/m5_gather_qmm_nax.py:1642-1657 | omlx/patches/m5_gather_qmm_nax.py:1690-1705 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (16 lines × 2) omlx/patches/mlx_vlm_mtp/qwen35_moe_vlm_model.py:149— omlx/patches/mlx_vlm_mtp/qwen35_moe_vlm_model.py:149-164 | omlx/patches/mlx_vlm_mtp/qwen35_vlm_model.py:107-122 — before extracting anything, compare `omlx/patches/mlx_vlm_mtp/qwen35_moe_vlm_model.py` and `omlx/patches/mlx_vlm_mtp/qwen35_vlm_model.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 52 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 (16 lines × 2) apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift:493— apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift:493-508 | apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift:579-594 — both copies are in the same file, so extract the 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 `apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift:493` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (16 lines × 2) apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:2450— apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:2450-2465 | apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:2485-2500 — both copies are in the same file, so extract the 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 `apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:2450` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (7 lines × 3) omlx/patches/bailing_hybrid/bailing_hybrid_model.py:298— omlx/patches/bailing_hybrid/bailing_hybrid_model.py:298-304 | omlx/patches/glm_moe_dsa/glm_moe_dsa_model.py:242-250 | omlx/patches/glm_moe_dsa/glm_moe_dsa_model.py:386-394 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `omlx/patches/glm_moe_dsa/glm_moe_dsa_model.py:242` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 3) omlx/patches/k2_horizon/k2_horizon_model.py:325— omlx/patches/k2_horizon/k2_horizon_model.py:325-331 | omlx/patches/laguna/laguna_model.py:430-436 | omlx/patches/mimo_v2/mimo_v2_model.py:172-178 — 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 (7 lines × 3) omlx/patches/qwen35_ane_prefill.py:463— omlx/patches/qwen35_ane_prefill.py:463-469 | omlx/patches/qwen35_ane_prefill.py:542-548 | omlx/patches/qwen35_ane_prefill.py:1538-1544 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `omlx/patches/qwen35_ane_prefill.py:463` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 3) apps/omlx-mac/Sources/AppView/Screens/IntegrationsScreen.swift:624— apps/omlx-mac/Sources/AppView/Screens/IntegrationsScreen.swift:624-633 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1379-1385 | apps/omlx-mac/Sources/AppView/Screens/NetworkScreen.swift:135-144 — 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 `apps/omlx-mac/Sources/AppView/Screens/IntegrationsScreen.swift:624` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (7 lines × 3) apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1257— apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1257-1263 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1298-1304 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2793-2799 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1257` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 3) apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1336— apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1336-1342 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2399-2405 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2841-2847 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1336` 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 first that the copies are not typed on the same thing: the declarations holding them bind `label` to `String(localized: "settings.experimental.qwen_oq_a8.label", defaultValue: "INT8 Activation Prefill", comment: "Row label for the oQ INT8-activation prefill kernels")` in one and `String(localized: "settings.experimental.specprefill.keep_rate.label", defaultValue: "Keep Rate", comment: "Row label for the SpecPrefill keep-rate dropdown")` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (7 lines × 3) apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2206— apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2206-2212 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2334-2340 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2820-2826 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2206` 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 first that the copies are not typed on the same thing: the declarations holding them bind `label` to `String(localized: "settings.acceleration.mtp.label", defaultValue: "Lightning MTP", comment: "Row label for the Lightning MTP toggle")` in one and `String(localized: "settings.experimental.vlm_mtp.label", defaultValue: "VLM MTP", comment: "Row label for the VLM MTP toggle")` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (7 lines × 3) apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:353— apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:353-359 | apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:714-720 | apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift:659-665 — 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, `apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:712` calls `rotationEffect`, `degrees`, `animation` and `apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:352` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 3) REDACTED:972— REDACTED:972-977 | REDACTED:992-997 | REDACTED:1014-1019 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 3) omlx/patches/deepseek_v4/deepseek_v4_model.py:1736— omlx/patches/deepseek_v4/deepseek_v4_model.py:1736-1741 | omlx/patches/deepseek_v4/deepseek_v4_model.py:1850-1855 | omlx/patches/deepseek_v4/deepseek_v4_model.py:2022-2027 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 3) omlx/patches/deepseek_v4/deepseek_v4_model.py:1746— omlx/patches/deepseek_v4/deepseek_v4_model.py:1746-1751 | omlx/patches/deepseek_v4/deepseek_v4_model.py:1876-1881 | omlx/patches/deepseek_v4/deepseek_v4_model.py:2145-2150 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 3) omlx/patches/bailing_hybrid/bailing_hybrid_model.py:1068— omlx/patches/bailing_hybrid/bailing_hybrid_model.py:1068-1073 | omlx/patches/hy_v3/hy_v3_model.py:381-386 | omlx/patches/laguna/laguna_model.py:784-789 — 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 (6 lines × 3) omlx/patches/k2_horizon/k2_horizon_model.py:446— omlx/patches/hy_v3/hy_v3_model.py:268-273 | omlx/patches/k2_horizon/k2_horizon_model.py:446-451 | omlx/patches/laguna/laguna_model.py:568-573 — 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 (6 lines × 3) apps/omlx-mac/Sources/AppView/Screens/AccuracyBenchScreen.swift:879— apps/omlx-mac/Sources/AppView/Screens/AccuracyBenchScreen.swift:879-884 | apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:346-351 | apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift:652-657 — 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 `apps/omlx-mac/Sources/AppView/Screens/AccuracyBenchScreen.swift:879` 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 first that the copies are not typed on the same thing: the declarations holding them bind `spacing` to `8` in one and `0` 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 before the matched lines, `apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift:651` calls `HStack` and `apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:345` 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 (6 lines × 3) apps/omlx-mac/Sources/AppView/Screens/NetworkScreen.swift:29— apps/omlx-mac/Sources/AppView/Screens/NetworkScreen.swift:29-34 | apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift:31-36 | apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:189-196 — before extracting anything, compare `apps/omlx-mac/Sources/AppView/Screens/NetworkScreen.swift` and `apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 95 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 `apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:189` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Low cohesion: ModelRegistry (LCOM4 7) omlx/model_registry.py:30— ModelRegistry's methods fall into 7 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 7 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: QSAKVCache (LCOM4 6) omlx/patches/mlx_vlm_qwen4_exp_compat/vendor/mlx_vlm/models/qwen4_exp/language.py:481— QSAKVCache's methods fall into 6 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 6 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: MemoryMonitor (LCOM4 5) REDACTED:221— MemoryMonitor's methods fall into 5 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 5 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: _LazyTensorIndex (LCOM4 5) omlx/oq.py:5374— _LazyTensorIndex's methods fall into 5 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 5 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: Scheduler (LCOM4 5) omlx/scheduler.py:2170— Scheduler's methods fall into 5 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 5 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: ServiceMailbox (LCOM4 4) omlx/cluster/rdma/mailbox.py:159— ServiceMailbox's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: AsyncEngineCore (LCOM4 4) omlx/engine_core.py:1477— AsyncEngineCore'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.
ClassTooLong: ModelSettingsScreenVM apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:34— ClassTooLong — 1670 significant lines (blank, comment-only and punctuation-only lines excluded), 58 methods. The bar is 400 significant lines; this is 1270 over it, 4.18× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: MenubarController apps/omlx-mac/Sources/Menubar/MenubarController.swift:26— ClassTooLong — 903 significant lines (blank, comment-only and punctuation-only lines excluded), 64 methods. The bar is 400 significant lines; this is 503 over it, 2.26× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: TalkAIController apps/omlx-mac/Sources/AskAI/TalkAIController.swift:12— ClassTooLong — 547 significant lines (blank, comment-only and punctuation-only lines excluded), 44 methods. The bar is 400 significant lines; this is 147 over it, 1.37× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: ProfileDetailCard apps/omlx-mac/Sources/AppView/Screens/ProfileViews.swift:500— ClassTooLong — 534 significant lines (blank, comment-only and punctuation-only lines excluded), 16 methods. The bar is 400 significant lines; this is 134 over it, 1.34× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: ServerScreenVM apps/omlx-mac/Sources/AppView/ViewModels/ServerScreenVM.swift:3— ClassTooLong — 530 significant lines (blank, comment-only and punctuation-only lines excluded), 30 methods. The bar is 400 significant lines; this is 130 over it, 1.33× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: ModelCardSheet apps/omlx-mac/Sources/AppView/Screens/ModelCardSheet.swift:95— ClassTooLong — 469 significant lines (blank, comment-only and punctuation-only lines excluded), 20 methods. The bar is 400 significant lines; this is 69 over it, 1.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D4 · Code Duplication· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×6
Members sharing a duplicated core (4 members, 50+ identical tokens) omlx/cluster/incidents.py:139— omlx/cluster/incidents.py:139-161 | omlx/cluster/registry.py:52-84 | omlx/cluster/registry.py:244-265 | omlx/cluster/strategy_benchmarks.py:131-144 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) REDACTED:1167— REDACTED:1167-1242 | REDACTED:1257-1382 | omlx/engine/vlm.py:4850-4948 | omlx/engine/vlm.py:4968-5108 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) apps/omlx-mac/Sources/AppView/Screens/AccuracyBenchScreen.swift:44— apps/omlx-mac/Sources/AppView/Screens/AccuracyBenchScreen.swift:44-92 | apps/omlx-mac/Sources/AppView/Screens/ContextBenchScreen.swift:32-81 | apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:51-145 | apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift:44-113 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:692— apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:692-727 | apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:1060-1106 | apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:1537-1575 | apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:866-920 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) apps/omlx-mac/Sources/AppView/ViewModels/IntegrationsScreenVM.swift:155— apps/omlx-mac/Sources/AppView/ViewModels/IntegrationsScreenVM.swift:155-170 | apps/omlx-mac/Sources/AppView/ViewModels/ServerScreenVM.swift:520-536 | apps/omlx-mac/Sources/Welcome/WelcomeWindow.swift:221-236 | apps/omlx-mac/Sources/Welcome/WelcomeWindow.swift:238-253 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) apps/omlx-mac/Sources/AppView/ViewModels/IntegrationsScreenVM.swift:172— apps/omlx-mac/Sources/AppView/ViewModels/IntegrationsScreenVM.swift:172-184 | apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:646-658 | apps/omlx-mac/Sources/AppView/ViewModels/SecurityScreenVM.swift:13-25 | apps/omlx-mac/Sources/AppView/ViewModels/ServerScreenVM.swift:722-734 — 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.
Outbound HTTP without resilience REDACTED:40— `urllib.request.urlopen(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Outbound HTTP without resilience REDACTED:452— `requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Outbound HTTP without resilience REDACTED:865— `requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Outbound HTTP without resilience omlx/scheduler.py:3841— `requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Outbound HTTP without resilience omlx/scheduler.py:16064— `requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Outbound HTTP without resilience REDACTED:127— `urllib.request.urlopen(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Duplicated block (21 lines × 2) omlx/cache/boundary_snapshot_store.py:1617— omlx/cache/boundary_snapshot_store.py:1617-1637 | omlx/cache/boundary_snapshot_store.py:1662-1682 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `omlx/cache/boundary_snapshot_store.py:1639` calls `_restore_tensor_from_bytes` and `omlx/cache/boundary_snapshot_store.py:1683` 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 (21 lines × 2) omlx/cache/boundary_snapshot_store.py:1732— omlx/cache/boundary_snapshot_store.py:1732-1752 | omlx/cache/boundary_snapshot_store.py:1898-1918 — both copies are in the same file, so extract the 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 (21 lines × 2) omlx/cluster/minimax_decode_smoke_worker.py:136— omlx/cluster/minimax_decode_smoke_worker.py:136-158 | omlx/cluster/pipeline_smoke_worker.py:103-123 — 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 `omlx/cluster/minimax_decode_smoke_worker.py:136` 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 (21 lines × 2) omlx/oq.py:3236— omlx/oq.py:3236-3256 | omlx/oq.py:3266-3286 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `omlx/oq.py:3263` calls `list`, `sum` and `omlx/oq.py:3235` 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 (21 lines × 2) apps/omlx-mac/Sources/AppView/Screens/NetworkScreen.swift:28— apps/omlx-mac/Sources/AppView/Screens/NetworkScreen.swift:28-48 | apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift:30-50 — before extracting anything, compare `apps/omlx-mac/Sources/AppView/Screens/NetworkScreen.swift` and `apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 95 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 `apps/omlx-mac/Sources/AppView/Screens/NetworkScreen.swift:28` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (18–19 lines × 2) omlx/cache/paged_ssd_cache.py:4318— omlx/cache/paged_ssd_cache.py:4318-4336 | omlx/cache/paged_ssd_cache.py:4502-4519 — both copies are in the same file, so extract the 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (18–19 lines × 2) omlx/cluster/incidents.py:164— omlx/cluster/incidents.py:164-181 | omlx/cluster/registry.py:87-105 — 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 (18–19 lines × 2) omlx/patches/qwen35_ane_prefill.py:617— omlx/patches/qwen35_ane_prefill.py:617-634 | omlx/patches/qwen35_ane_prefill.py:754-772 — both copies are in the same file, so extract the 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 `omlx/patches/qwen35_ane_prefill.py:617` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (18–19 lines × 2) omlx/scheduler.py:13848— omlx/scheduler.py:13848-13866 | omlx/scheduler.py:13931-13948 — both copies are in the same file, so extract the 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 `omlx/scheduler.py:13848` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (18–19 lines × 2) apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:38— apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:38-55 | apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:763-781 — both copies are in the same file, so extract the 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 `apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:38` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with 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 (18 lines × 2) omlx/cache/prefix_cache.py:362— omlx/cache/prefix_cache.py:362-379 | omlx/cache/prefix_cache.py:5658-5675 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) REDACTED:1225— REDACTED:1225-1242 | omlx/engine/vlm.py:4931-4948 — before extracting anything, compare `REDACTED` and `omlx/engine/vlm.py` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1225` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:1224` calls `pop` and `omlx/engine/vlm.py:4930` 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 (18 lines × 2) omlx/patches/deepseek_v4/cache_extras.py:158— omlx/patches/deepseek_v4/cache_extras.py:158-175 | omlx/patches/deepseek_v4/cache_extras.py:532-549 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `omlx/patches/deepseek_v4/cache_extras.py:158` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (18 lines × 2) apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:576— apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:576-593 | apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:756-773 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:576` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (18 lines × 2) apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:659— apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:659-676 | apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:821-838 — both copies are in the same file, so extract the 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 `apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:659` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) omlx/adapter/muse_glimmer.py:172— omlx/adapter/muse_glimmer.py:172-188 | omlx/adapter/output_parser.py:999-1015 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (17 lines × 2) omlx/cluster/staging.py:798— omlx/cluster/staging.py:798-814 | omlx/cluster/staging.py:943-959 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) omlx/patches/deepseek_v4/chat_template_v4.py:415— omlx/patches/deepseek_v4/chat_template_v4.py:415-431 | omlx/patches/deepseek_v41/encoding.py:668-684 — before extracting anything, compare `omlx/patches/deepseek_v4/chat_template_v4.py` and `omlx/patches/deepseek_v41/encoding.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 210 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `omlx/patches/deepseek_v4/chat_template_v4.py:415` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) omlx/patches/qwen35_ane_prefill.py:1157— omlx/patches/qwen35_ane_prefill.py:1157-1173 | omlx/patches/qwen35_ane_prefill.py:1401-1417 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (17 lines × 2) REDACTED:8060— REDACTED:8060-8076 | REDACTED:8810-8826 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:8060` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 3) omlx/patches/bailing_hybrid/bailing_hybrid_model.py:593— omlx/patches/bailing_hybrid/bailing_hybrid_model.py:593-597 | omlx/patches/glm_moe_dsa/deepseek_v32.py:633-637 | omlx/patches/mimo_v2/mimo_v2_model.py:248-252 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (5 lines × 3) omlx/cluster/inference_worker.py:780— omlx/cluster/inference_worker.py:780-784 | omlx/cluster/telemetry.py:730-734 | omlx/engine/distributed.py:1161-1166 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `omlx/engine/distributed.py:1161` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 3) REDACTED:1959— REDACTED:1959-1963 | omlx/admin/hf_uploader.py:656-660 | omlx/admin/ms_downloader.py:874-878 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (5 lines × 3) REDACTED:3422— REDACTED:3422-3426 | REDACTED:3454-3458 | REDACTED:3474-3478 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 3) apps/omlx-mac/Sources/AskAI/MicrophoneAccess.swift:33— apps/omlx-mac/Sources/AskAI/MicrophoneAccess.swift:33-37 | apps/omlx-mac/Sources/AskAI/PromptPlaceholders.swift:85-89 | apps/omlx-mac/Sources/AskAI/ScreenCapture.swift:18-22 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
R4 · Test Coverage· No test reaches this file · ×5
No test reaches this file apps/omlx-web/omlx_web/static/js/cluster_v2.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file apps/omlx-web/omlx_web/static/js/custom_theme.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file REDACTED:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file apps/omlx-web/omlx_web/static/js/dashboard_layout.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file apps/omlx-web/omlx_web/static/js/marked-highlight.umd.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
Change coupling: qwen35_moe_vlm_model.py ↔ qwen35_moe_vlm_runtime.py omlx/patches/mlx_vlm_mtp/qwen35_moe_vlm_model.py:1— `omlx/patches/mlx_vlm_mtp/qwen35_moe_vlm_model.py` and `omlx/patches/mlx_vlm_mtp/qwen35_moe_vlm_runtime.py` change together 80% of the time (8 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) 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 `8be91344` chore: bump mlx-vlm to 9790231 (v0.7.8) (#4529); `940c7983` fix: load MLX-format MTP head norms as stored (#3742) (#3788); `a5911924` feat: support Ornith models in oQ and inference (#2044) — run `git show` on any of them.
Change coupling: PerformanceScreen.swift ↔ GlobalSettingsDTO.swift apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift:1— `apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift` and `apps/omlx-mac/Sources/Net/DTO/GlobalSettingsDTO.swift` change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets). They sit in different directories, but in this ecosystem the namespace is declared in the FILE, not by the folder — so the two may well share one namespace and reference each other with no import for this pass to see. Read the pair before acting: if one derives from or overrides the other, the dependency is explicit in the type declaration and the co-change is definitional; if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE and the thing to add is a comment saying so; if they simply belong together, co-locate them; if none of these holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `e6d5989e` fix(cache): turn the SSD cache off when its configured dir is unavail…; `d610102a` fix(admin): allow disabling idle timeout from the macOS app (#2498); `839e811c` feat(mac): show effective memory ceiling and Metal cap warning in Per… — run `git show` on any of them.
Change coupling: qwen35_model.py ↔ qwen35_moe_vlm_model.py omlx/patches/mlx_lm_mtp/qwen35_model.py:1— `omlx/patches/mlx_lm_mtp/qwen35_model.py` and `omlx/patches/mlx_vlm_mtp/qwen35_moe_vlm_model.py` change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `940c7983` fix: load MLX-format MTP head norms as stored (#3742) (#3788); `a5911924` feat: support Ornith models in oQ and inference (#2044); `f0510008` fix(oq): defer MTP norm shift decisions — run `git show` on any of them.
Change coupling: embedding.py ↔ reranker.py omlx/engine/embedding.py:1— `omlx/engine/embedding.py` and `omlx/engine/reranker.py` change together 50% of the time (6 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `beca2e36` fix(security): default trust_remote_code to false with per-model opt-…; `bda11fc4` fix: synchronize GPU before clearing Metal buffer cache (#300); `5e58c97d` fix: remove keepalive warmup loop that caused sustained GPU spike (#292) — run `git show` on any of them.
D4 · Code Duplication· Members sharing a duplicated core (5 members, 50+ identical tokens) · ×4
Members sharing a duplicated core (5 members, 50+ identical tokens) omlx/eval/arc.py:29— omlx/eval/arc.py:29-52 | omlx/eval/bbq.py:29-54 | omlx/eval/mathqa.py:28-52 | omlx/eval/mmlu_pro.py:31-55 | omlx/eval/safetybench.py:29-53 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) omlx/eval/arc.py:55— omlx/eval/arc.py:55-70 | omlx/eval/bbq.py:57-74 | omlx/eval/mathqa.py:55-70 | omlx/eval/mmlu_pro.py:58-73 | omlx/eval/safetybench.py:56-72 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) REDACTED:4622— REDACTED:4622-4853 | REDACTED:5039-5543 | REDACTED:6096-6295 | REDACTED:8013-8293 | REDACTED:8590-9124 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) apps/omlx-mac/Sources/AppView/Screens/AccuracyBenchScreen.swift:765— apps/omlx-mac/Sources/AppView/Screens/AccuracyBenchScreen.swift:765-820 | apps/omlx-mac/Sources/AppView/Screens/DownloadsScreen.swift:251-285 | apps/omlx-mac/Sources/AppView/Screens/DownloadsScreen.swift:407-441 | apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift:832-889 | apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift:899-925 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Duplicated block (28 lines × 2) omlx/admin/hf_uploader.py:452— omlx/admin/hf_uploader.py:452-479 | omlx/admin/hf_uploader.py:502-529 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (28 lines × 2) omlx/cache/paged_ssd_cache.py:4400— omlx/cache/paged_ssd_cache.py:4400-4427 | omlx/cache/paged_ssd_cache.py:4436-4463 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `omlx/cache/paged_ssd_cache.py:4465` calls `_promote_pending_write_to_hot_cache` and `omlx/cache/paged_ssd_cache.py:4428` 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 (28 lines × 2) omlx/engine/vlm.py:1111— omlx/engine/vlm.py:1111-1138 | omlx/engine/vlm.py:1230-1257 — both copies are in the same file, so extract the 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 (28 lines × 2) apps/omlx-mac/Sources/AppView/Screens/ContextBenchScreen.swift:172— apps/omlx-mac/Sources/AppView/Screens/ContextBenchScreen.swift:172-199 | apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift:291-318 — before extracting anything, compare `apps/omlx-mac/Sources/AppView/Screens/ContextBenchScreen.swift` and `apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 159 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 `apps/omlx-mac/Sources/AppView/Screens/ContextBenchScreen.swift:172` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14–15 lines × 2) omlx/cache/boundary_snapshot_store.py:1833— omlx/cache/boundary_snapshot_store.py:1833-1847 | omlx/cache/boundary_snapshot_store.py:1988-2001 — both copies are in the same file, so extract the 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 `omlx/cache/boundary_snapshot_store.py:1833` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14–15 lines × 2) REDACTED:982— REDACTED:982-996 | omlx/engine/vlm.py:4726-4739 — before extracting anything, compare `REDACTED` and `omlx/engine/vlm.py` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 469 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 (14–15 lines × 2) omlx/patches/glm_moe_dsa/deepseek_v32.py:796— omlx/patches/glm_moe_dsa/deepseek_v32.py:796-810 | omlx/patches/glm_moe_dsa/glm_moe_dsa_model.py:447-460 — 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 (14–15 lines × 2) REDACTED:9055— REDACTED:9055-9068 | REDACTED:9749-9763 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13–15 lines × 2) omlx/cluster/ssh_keys.py:392— omlx/cluster/ssh_keys.py:392-404 | omlx/cluster/ssh_keys.py:428-442 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13–15 lines × 2) omlx/engine/sts.py:393— omlx/engine/sts.py:393-405 | omlx/engine/tts.py:401-415 — 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 `omlx/engine/sts.py:393` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13–15 lines × 2) omlx/patches/deepseek_v4/moe_offload.py:344— omlx/patches/deepseek_v4/moe_offload.py:344-358 | omlx/patches/glm_moe_dsa/moe_offload.py:379-391 — `omlx/patches/deepseek_v4/moe_offload.py` and `omlx/patches/glm_moe_dsa/moe_offload.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 10 separate duplicated blocks between them, totalling at least 144 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `omlx/patches/deepseek_v4/moe_offload.py:359` calls `_is_mtp_path` and `omlx/patches/glm_moe_dsa/moe_offload.py:392` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13–15 lines × 2) REDACTED:1173— REDACTED:1173-1185 | omlx/patches/mlx_vlm_mtp/inkling_vlm_runtime.py:852-866 — 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 (12 lines × 3) omlx/admin/routes.py:5208— omlx/admin/routes.py:5208-5219 | omlx/admin/routes.py:5249-5260 | omlx/admin/routes.py:5279-5290 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12 lines × 3) apps/omlx-mac/Sources/AppView/Screens/AccuracyBenchScreen.swift:258— apps/omlx-mac/Sources/AppView/Screens/AccuracyBenchScreen.swift:258-269 | apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:231-242 | apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:1136-1147 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/omlx-mac/Sources/AppView/Screens/AccuracyBenchScreen.swift:258` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (12 lines × 3) apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:730— apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:730-741 | apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:1109-1120 | apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:1578-1589 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (12 lines × 3) apps/omlx-mac/Sources/AppView/ViewModels/IntegrationsScreenVM.swift:173— apps/omlx-mac/Sources/AppView/ViewModels/IntegrationsScreenVM.swift:173-184 | apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:647-658 | apps/omlx-mac/Sources/AppView/ViewModels/SecurityScreenVM.swift:14-25 — 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 `apps/omlx-mac/Sources/AppView/ViewModels/IntegrationsScreenVM.swift:173` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (11 lines × 3) omlx/api/audio_routes.py:362— omlx/api/audio_routes.py:362-372 | omlx/api/audio_routes.py:411-421 | omlx/api/audio_routes.py:1606-1616 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 3) omlx/patches/mlx_lm_mtp/qwen35_model.py:622— omlx/patches/mlx_lm_mtp/qwen35_model.py:622-632 | omlx/patches/mlx_vlm_mtp/qwen35_moe_vlm_runtime.py:339-349 | omlx/patches/mlx_vlm_mtp/qwen35_vlm_runtime.py:405-415 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `omlx/patches/mlx_lm_mtp/qwen35_model.py:622` 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 (11 lines × 3) omlx/patches/qwen35_ane_prefill.py:535— omlx/patches/qwen35_ane_prefill.py:535-545 | omlx/patches/qwen35_ane_prefill.py:1228-1238 | omlx/patches/qwen35_ane_prefill.py:1531-1541 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 3) apps/omlx-mac/Sources/AppView/ViewModels/ServerScreenVM.swift:522— apps/omlx-mac/Sources/AppView/ViewModels/ServerScreenVM.swift:522-532 | apps/omlx-mac/Sources/Welcome/WelcomeWindow.swift:222-232 | apps/omlx-mac/Sources/Welcome/WelcomeWindow.swift:239-249 — 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 (14 lines × 2 locations) apps/omlx-web/omlx_web/static/js/cluster_v2.js:3736— apps/omlx-web/omlx_web/static/js/cluster_v2.js:3736 · apps/omlx-web/omlx_web/static/js/cluster_v2.js:3760 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2 locations) REDACTED:1669— REDACTED:1669 · REDACTED:1692 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (14 lines × 2 locations) REDACTED:1788— REDACTED:1788 · REDACTED:3495 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (14 lines × 2 locations) REDACTED:6913— REDACTED:6913 · REDACTED:7150 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (12 lines × 2 locations) REDACTED:2486— REDACTED:2486 · REDACTED:2654 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (12 lines × 2 locations) REDACTED:3779— REDACTED:3779 · REDACTED:3950 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2 locations) REDACTED:4254— REDACTED:4254 · REDACTED:4697 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (12 lines × 2 locations) REDACTED:7710— REDACTED:7710 · REDACTED:9077 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2 locations) REDACTED:1605— REDACTED:1605 · REDACTED:1908 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2 locations) REDACTED:2553— REDACTED:2553 · REDACTED:2699 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (11 lines × 2 locations) REDACTED:6496— REDACTED:6496 · REDACTED:6616 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2 locations) REDACTED:8231— REDACTED:8231 · REDACTED:8290 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (8 lines × 2 locations) REDACTED:1573— REDACTED:1573 · REDACTED:6875 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (8 lines × 2 locations) REDACTED:4547— REDACTED:4547 · REDACTED:5714 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (8 lines × 2 locations) REDACTED:5393— REDACTED:5393 · REDACTED:6209 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (8 lines × 2 locations) REDACTED:8491— REDACTED:8491 · REDACTED:9346 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
X17 · Uncapped recursion over a caller-supplied document· Recursive walk over a caller-supplied document has no depth cap · ×4
Recursive walk over a caller-supplied document has no depth cap REDACTED:1975— `collect_kv_layer_specs` is public, takes a document from its caller (line 1925) and hands it to `_walk`, which calls itself at line 1975 (`_walk`) with a piece of `c` — and nowhere in `_walk` 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 `_walk` 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 omlx/cluster/prompt_snapshot_cache.py:99— `from_state` is public, takes a document from its caller (line 251) and hands it to `_from_wire_state`, which calls itself at line 99 (`_from_wire_state`) with a piece of `state` — and nowhere in `_from_wire_state` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_from_wire_state` 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 omlx/api/utils.py:42— `find_lone_surrogate` is public and takes `value: Any` from its caller, and it calls itself at line 42 (`find_lone_surrogate`) with a piece of `value` (and at line 47) — and nowhere in `find_lone_surrogate` 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 `find_lone_surrogate` 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 omlx/api/utils.py:363— `chat_template_preserves_mid_system` is public, takes a document from its caller (line 437) and hands it to `_freeze_template_value`, which calls itself at line 363 (`_freeze_template_value`) with a piece of `value` (and at line 366, line 368) — and nowhere in `_freeze_template_value` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_freeze_template_value` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
FunctionTooLong: chat.html.chatApp apps/omlx-web/omlx_web/templates/chat.html:2841— FunctionTooLong — chatApp runs 3992 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 3892 over it, 39.92× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: cluster_v2.clusterV2Wizard apps/omlx-web/omlx_web/static/js/cluster_v2.js:49— FunctionTooLong — clusterV2Wizard runs 2935 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 2835 over it, 29.35× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: cluster_v2.clusterV2Wizard.checkRows apps/omlx-web/omlx_web/static/js/cluster_v2.js:2073— FunctionTooLong — clusterV2Wizard.checkRows runs 156 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 56 over it, 1.56× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
Duplicated block (30 lines × 2) REDACTED:483— REDACTED:483-512 | omlx/engine/vlm.py:2550-2579 — before extracting anything, compare `REDACTED` and `omlx/engine/vlm.py` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:483` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (30 lines × 2) omlx/engine/vlm.py:5154— omlx/engine/vlm.py:5154-5183 | omlx/engine/vlm.py:5412-5441 — both copies are in the same file, so extract the 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 (30 lines × 2) REDACTED:8232— REDACTED:8232-8261 | REDACTED:8998-9027 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:8232` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (25 lines × 2) omlx/oq.py:11243— omlx/oq.py:11243-11267 | omlx/oq.py:11929-11953 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `omlx/oq.py:11927` calls `synchronize`, `clear_cache` and `omlx/oq.py:11242` 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 (25 lines × 2) omlx/patches/mlx_vlm_mtp/qwen35_moe_vlm_runtime.py:88— omlx/patches/mlx_vlm_mtp/qwen35_moe_vlm_runtime.py:88-112 | omlx/patches/mlx_vlm_mtp/qwen35_vlm_runtime.py:163-187 — before extracting anything, compare `omlx/patches/mlx_vlm_mtp/qwen35_moe_vlm_runtime.py` and `omlx/patches/mlx_vlm_mtp/qwen35_vlm_runtime.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 282 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 (25 lines × 2) REDACTED:7782— REDACTED:7782-7806 | REDACTED:9860-9884 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20 lines × 2) omlx/cluster/planner.py:1770— omlx/cluster/planner.py:1770-1789 | omlx/cluster/planner.py:2402-2421 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20 lines × 2) omlx/eval/humaneval.py:172— omlx/eval/humaneval.py:172-191 | omlx/eval/winogrande.py:30-49 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `omlx/eval/humaneval.py:193` calls `get_max_tokens` and `omlx/eval/winogrande.py:51` 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 (20 lines × 2) REDACTED:1078— REDACTED:1078-1097 | omlx/engine/vlm.py:4767-4786 — before extracting anything, compare `REDACTED` and `omlx/engine/vlm.py` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 469 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 (15–16 lines × 2) omlx/admin/routes.py:8827— omlx/admin/routes.py:8827-8841 | omlx/admin/routes.py:9444-9459 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15–16 lines × 2) omlx/engine/vlm.py:5186— omlx/engine/vlm.py:5186-5201 | omlx/engine/vlm.py:5444-5458 — both copies are in the same file, so extract the 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 `omlx/engine/vlm.py:5186` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (15–16 lines × 2) omlx/patches/deepseek_v4/switch_layers.py:430— omlx/patches/deepseek_v4/switch_layers.py:430-444 | omlx/patches/glm_moe_dsa/switch_layers.py:153-168 — `omlx/patches/deepseek_v4/switch_layers.py` and `omlx/patches/glm_moe_dsa/switch_layers.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 6 separate duplicated blocks between them, totalling at least 75 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (14–16 lines × 2) omlx/admin/routes.py:9300— omlx/admin/routes.py:9300-9315 | omlx/admin/routes.py:9548-9561 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (14–16 lines × 2) omlx/patches/glm_moe_dsa/deepseek_v32.py:538— omlx/patches/glm_moe_dsa/deepseek_v32.py:538-551 | omlx/patches/index_cache.py:167-182 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `omlx/patches/glm_moe_dsa/deepseek_v32.py:538` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (14–16 lines × 2) omlx/patches/qwen35_ane_prefill.py:714— omlx/patches/qwen35_ane_prefill.py:714-729 | omlx/patches/qwen35_ane_prefill.py:916-929 — both copies are in the same file, so extract the 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 `omlx/patches/qwen35_ane_prefill.py:714` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13–16 lines × 2) omlx/api/anthropic_utils.py:447— omlx/api/anthropic_utils.py:447-459 | omlx/api/anthropic_utils.py:678-693 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `omlx/api/anthropic_utils.py:447` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (13–16 lines × 2) omlx/cache/prefix_cache.py:2307— omlx/cache/prefix_cache.py:2307-2319 | omlx/cache/prefix_cache.py:2864-2879 — both copies are in the same file, so extract the 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 `omlx/cache/prefix_cache.py:2307` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13–16 lines × 2) omlx/patches/deepseek_v4/wsdpa_attention.py:310— omlx/patches/deepseek_v4/wsdpa_attention.py:310-322 | omlx/patches/deepseek_v4/wsdpa_attention.py:395-410 — both copies are in the same file, so extract the 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 `omlx/patches/deepseek_v4/wsdpa_attention.py:310` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (13–14 lines × 2) omlx/cache/boundary_snapshot_store.py:1640— omlx/cache/boundary_snapshot_store.py:1640-1652 | omlx/cache/boundary_snapshot_store.py:1682-1695 — both copies are in the same file, so extract the 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 `omlx/cache/boundary_snapshot_store.py:1682` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `omlx/cache/boundary_snapshot_store.py:1639` calls `_restore_tensor_from_bytes` and `omlx/cache/boundary_snapshot_store.py:1682` 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 × 2) apps/omlx-mac/Sources/AppView/Screens/NetworkScreen.swift:95— apps/omlx-mac/Sources/AppView/Screens/NetworkScreen.swift:95-107 | apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:479-492 — before extracting anything, compare `apps/omlx-mac/Sources/AppView/Screens/NetworkScreen.swift` and `apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 55 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 `apps/omlx-mac/Sources/AppView/Screens/NetworkScreen.swift:95` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (13–14 lines × 2) apps/omlx-mac/Sources/Menubar/MenubarStatsPoller.swift:417— apps/omlx-mac/Sources/Menubar/MenubarStatsPoller.swift:417-430 | apps/omlx-mac/Sources/Menubar/MenubarStatsPoller.swift:434-446 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/omlx-mac/Sources/Menubar/MenubarStatsPoller.swift:417` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13 lines × 3) omlx/adapter/output_parser.py:246— omlx/adapter/output_parser.py:246-258 | omlx/adapter/output_parser.py:590-602 | omlx/adapter/output_parser.py:697-709 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `omlx/adapter/output_parser.py:710` calls `_MiniMaxM3ProtocolNormalizer` and `omlx/adapter/output_parser.py:260` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13 lines × 3) REDACTED:1578— REDACTED:1578-1590 | REDACTED:1646-1658 | REDACTED:1870-1882 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1578` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 3) apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:692— apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:692-704 | apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:1060-1072 | apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:1537-1549 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:692` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:706` calls `Spacer` and `apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:1551` 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 (9–10 lines × 2) omlx/oq.py:8704— omlx/oq.py:8704-8713 | omlx/oq.py:8717-8725 — both copies are in the same file, so extract the 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 `omlx/oq.py:8704` 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 (9–10 lines × 2) REDACTED:4394— REDACTED:4394-4403 | REDACTED:4507-4515 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:4394` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9–10 lines × 2) apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift:363— apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift:363-372 | apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift:381-389 — both copies are in the same file, so extract the 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 `apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift:363` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (9 lines × 4) omlx/cluster/enrollment.py:175— omlx/cluster/enrollment.py:175-183 | omlx/cluster/incidents.py:179-187 | omlx/cluster/registry.py:103-111 | omlx/cluster/registry.py:321-329 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (9 lines × 4) apps/omlx-mac/Sources/AppView/Screens/IntegrationsScreen.swift:580— apps/omlx-mac/Sources/AppView/Screens/IntegrationsScreen.swift:580-588 | apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:38-46 | apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:118-126 | apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:763-771 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `apps/omlx-mac/Sources/AppView/Screens/IntegrationsScreen.swift:580` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 4) apps/omlx-mac/Sources/AppView/ViewModels/IntegrationsScreenVM.swift:172— apps/omlx-mac/Sources/AppView/ViewModels/IntegrationsScreenVM.swift:172-180 | apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:646-654 | apps/omlx-mac/Sources/AppView/ViewModels/SecurityScreenVM.swift:13-21 | apps/omlx-mac/Sources/AppView/ViewModels/ServerScreenVM.swift:722-730 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/omlx-mac/Sources/AppView/ViewModels/IntegrationsScreenVM.swift:172` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8–9 lines × 2) omlx/cluster/launch.py:2040— omlx/cluster/launch.py:2040-2048 | omlx/cluster/launch.py:2192-2199 — both copies are in the same file, so extract the 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 `omlx/cluster/launch.py:2040` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8–9 lines × 2) omlx/oq.py:8483— omlx/oq.py:8483-8491 | omlx/oq.py:10157-10164 — both copies are in the same file, so extract the 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 `omlx/oq.py:8483` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8–9 lines × 2) omlx/scheduler.py:13908— omlx/scheduler.py:13908-13915 | omlx/scheduler.py:13929-13937 — both copies are in the same file, so extract the 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 `omlx/scheduler.py:13908` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 3) omlx/admin/routes.py:8832— omlx/admin/routes.py:8832-8839 | omlx/admin/routes.py:9037-9044 | omlx/admin/routes.py:9450-9457 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `omlx/admin/routes.py:8832` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 3) omlx/patches/mlx_vlm_mtp/qwen35_moe_vlm_model.py:132— omlx/patches/mlx_vlm_mtp/qwen35_moe_vlm_model.py:132-141 | omlx/patches/mlx_vlm_mtp/qwen35_moe_vlm_runtime.py:541-548 | omlx/patches/mlx_vlm_mtp/qwen35_vlm_model.py:89-102 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (8 lines × 3) apps/omlx-mac/Sources/AppView/Screens/AccuracyBenchScreen.swift:602— apps/omlx-mac/Sources/AppView/Screens/AccuracyBenchScreen.swift:602-609 | apps/omlx-mac/Sources/AppView/Screens/DownloadsScreen.swift:675-682 | apps/omlx-mac/Sources/AppView/Screens/ModelsScreen.swift:146-153 — 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 `apps/omlx-mac/Sources/AppView/Screens/AccuracyBenchScreen.swift:602` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `apps/omlx-mac/Sources/AppView/Screens/AccuracyBenchScreen.swift:612` calls `displayName`, `first` and `apps/omlx-mac/Sources/AppView/Screens/ModelsScreen.swift:155` 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 × 5) apps/omlx-mac/Sources/AppView/Screens/AccuracyBenchScreen.swift:768— apps/omlx-mac/Sources/AppView/Screens/AccuracyBenchScreen.swift:768-775 | apps/omlx-mac/Sources/AppView/Screens/DownloadsScreen.swift:253-260 | apps/omlx-mac/Sources/AppView/Screens/DownloadsScreen.swift:409-416 | apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift:878-885 | apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift:901-908 — 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.
Duplicated block (8 lines × 5) apps/omlx-mac/Sources/AppView/Screens/IntegrationsScreen.swift:580— apps/omlx-mac/Sources/AppView/Screens/IntegrationsScreen.swift:580-587 | apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift:184-193 | apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:38-45 | apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:118-125 | apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:763-770 — 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 `apps/omlx-mac/Sources/AppView/Screens/IntegrationsScreen.swift:580` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 5) apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:96— apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:96-103 | apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:130-137 | apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:155-162 | apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:169-176 | apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:208-215 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:96` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2 locations) REDACTED:2475— REDACTED:2475 · REDACTED:2601 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (7 lines × 2 locations) REDACTED:3417— REDACTED:3417 · REDACTED:3426 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (7 lines × 2 locations) REDACTED:6515— REDACTED:6515 · REDACTED:7004 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
AC6 · Visual & motion safety· Focus outline removed in CSS without a · ×2
Focus outline removed in CSS without a :focus replacement apps/omlx-web/omlx_web/templates/chat.html:603— `.inline-edit-textarea` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Focus outline removed in CSS without a :focus replacement apps/omlx-web/omlx_web/templates/chat.html:929— `.reasoning-slider input[type="range"]:focus` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Low contrast Tailwind colour pair (3.2:1) apps/omlx-web/omlx_web/templates/dashboard.html:29— This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade.
Low contrast Tailwind colour pair (3.2:1) apps/omlx-web/omlx_web/templates/dashboard/_bench.html:57— This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade.
Low contrast Tailwind colour pair (4.3:1) apps/omlx-web/omlx_web/templates/dashboard/_bench_accuracy.html:332— This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade.
Low contrast Tailwind colour pair (4.3:1) apps/omlx-web/omlx_web/templates/dashboard/_bench_accuracy.html:340— This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade.
Model.sanitize (cyclomatic 40) omlx/patches/deepseek_v4/deepseek_v4_model.py:2414— Model.sanitize has cyclomatic complexity 40 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
Model.sanitize (cyclomatic 40) omlx/patches/glm_moe_dsa/deepseek_v32.py:844— Model.sanitize has cyclomatic complexity 40 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
D4 · Code Duplication· Edited copy of a member (14 corresponding lines) · ×2
Edited copy of a member (14 corresponding lines) apps/omlx-mac/Sources/Menubar/MenubarStatsPoller.swift:413— apps/omlx-mac/Sources/Menubar/MenubarStatsPoller.swift:413-430 | apps/omlx-mac/Sources/Menubar/MenubarStatsPoller.swift:432-446 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:2467— apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:2467-2482 | apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:2506-2521 — 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· Members sharing a duplicated core (7 members, 50+ identical tokens) · ×2
Members sharing a duplicated core (7 members, 50+ identical tokens) omlx/cluster/enrollment.py:164— omlx/cluster/enrollment.py:164-183 | omlx/cluster/identity.py:140-155 | omlx/cluster/incidents.py:164-187 | REDACTED:230-245 | omlx/cluster/rdma/store.py:50-68 | omlx/cluster/registry.py:87-111 | omlx/cluster/registry.py:310-329 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
Members sharing a duplicated core (7 members, 50+ identical tokens) apps/omlx-mac/Sources/AppView/Screens/AccuracyBenchScreen.swift:581— apps/omlx-mac/Sources/AppView/Screens/AccuracyBenchScreen.swift:581-610 | apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:1271-1311 | apps/omlx-mac/Sources/AppView/Screens/DownloadsScreen.swift:622-698 | apps/omlx-mac/Sources/AppView/Screens/DownloadsScreen.swift:751-798 | apps/omlx-mac/Sources/AppView/Screens/DownloadsScreen.swift:817-915 | apps/omlx-mac/Sources/AppView/Screens/ModelsScreen.swift:104-158 | apps/omlx-mac/Sources/AppView/Screens/ModelsScreen.swift:204-381 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
Duplicated block (35 lines × 2) omlx/patches/qwen35_ane_prefill.py:653— omlx/patches/qwen35_ane_prefill.py:653-687 | omlx/patches/qwen35_ane_prefill.py:774-808 — both copies are in the same file, so extract the 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 `omlx/patches/qwen35_ane_prefill.py:653` 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 (35 lines × 2) apps/omlx-mac/Sources/AppView/Screens/ContextBenchScreen.swift:98— apps/omlx-mac/Sources/AppView/Screens/ContextBenchScreen.swift:98-132 | apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift:177-211 — before extracting anything, compare `apps/omlx-mac/Sources/AppView/Screens/ContextBenchScreen.swift` and `apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 159 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 `apps/omlx-mac/Sources/AppView/Screens/ContextBenchScreen.swift:98` 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 (34 lines × 2) REDACTED:807— REDACTED:807-840 | omlx/engine/vlm.py:2812-2845 — before extracting anything, compare `REDACTED` and `omlx/engine/vlm.py` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:807` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `omlx/engine/vlm.py:2848` calls `_inject_tool_calling` and `REDACTED:842` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (34 lines × 2) REDACTED:1167— REDACTED:1167-1200 | REDACTED:1257-1290 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1167` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (31 lines × 2) omlx/patches/qwen35_ane_prefill.py:1195— omlx/patches/qwen35_ane_prefill.py:1195-1225 | omlx/patches/qwen35_ane_prefill.py:1419-1449 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (31 lines × 2) apps/omlx-mac/Sources/AppView/Screens/DownloadsScreen.swift:255— apps/omlx-mac/Sources/AppView/Screens/DownloadsScreen.swift:255-285 | apps/omlx-mac/Sources/AppView/Screens/DownloadsScreen.swift:411-441 — both copies are in the same file, so extract the 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 `apps/omlx-mac/Sources/AppView/Screens/DownloadsScreen.swift:255` 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 (29 lines × 2) REDACTED:5407— REDACTED:5407-5435 | REDACTED:8209-8237 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:5407` 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 (29 lines × 2) REDACTED:7055— REDACTED:7055-7083 | REDACTED:7100-7128 — both copies are in the same file, so extract the 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–25 lines × 2) REDACTED:1577— REDACTED:1577-1600 | REDACTED:1645-1669 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1577` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:1575` calls `_cfg_get` and `REDACTED:1643` 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 (24–25 lines × 2) REDACTED:9430— REDACTED:9430-9454 | REDACTED:9502-9525 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18–25 lines × 2) omlx/patches/qwen35_verify_qmm.py:275— omlx/patches/qwen35_verify_qmm.py:275-292 | omlx/patches/qwen35_verify_qmm.py:296-320 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18–25 lines × 2) REDACTED:7477— REDACTED:7477-7501 | REDACTED:7561-7578 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:7561` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17–20 lines × 2) REDACTED:1500— REDACTED:1500-1519 | REDACTED:1533-1549 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1500` 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 (17–20 lines × 2) omlx/patches/deepseek_v4/chat_template_v4.py:435— omlx/patches/deepseek_v4/chat_template_v4.py:435-454 | omlx/patches/deepseek_v41/encoding.py:686-702 — before extracting anything, compare `omlx/patches/deepseek_v4/chat_template_v4.py` and `omlx/patches/deepseek_v41/encoding.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 210 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `omlx/patches/deepseek_v4/chat_template_v4.py:435` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (19 lines × 2) omlx/api/audio_routes.py:572— omlx/api/audio_routes.py:572-590 | omlx/api/audio_routes.py:1671-1689 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note first that the copies are not typed on the same thing: `STTEngine` names `..engine.stt` in one and `omlx.engine.stt` 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 (19 lines × 2) REDACTED:1896— REDACTED:1896-1914 | omlx/admin/ms_downloader.py:816-834 — 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 (16–19 lines × 2) omlx/scheduler.py:6917— omlx/scheduler.py:6917-6932 | omlx/scheduler.py:7169-7187 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16–19 lines × 2) REDACTED:5256— REDACTED:5256-5274 | REDACTED:8855-8870 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:5256` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16–18 lines × 2) omlx/eval/hellaswag.py:31— omlx/eval/hellaswag.py:31-48 | omlx/eval/jmmlu.py:42-57 — 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 (16–18 lines × 2) apps/omlx-mac/Sources/AppView/Screens/AppearanceScreen.swift:106— apps/omlx-mac/Sources/AppView/Screens/AppearanceScreen.swift:106-121 | apps/omlx-mac/Sources/AppView/Screens/AppearanceScreen.swift:153-170 — both copies are in the same file, so extract the 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 `apps/omlx-mac/Sources/AppView/Screens/AppearanceScreen.swift:106` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with 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 (15–17 lines × 2) omlx/admin/ane_tuning.py:1380— omlx/admin/ane_tuning.py:1380-1396 | omlx/admin/ane_tuning.py:1565-1579 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15–17 lines × 2) omlx/patches/mlx_lm_mtp/deepseek_v4_model.py:849— omlx/patches/mlx_lm_mtp/deepseek_v4_model.py:849-865 | omlx/patches/mlx_lm_mtp/deepseek_v4_model.py:867-881 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11–13 lines × 2) omlx/cluster/launch.py:1425— omlx/cluster/launch.py:1425-1437 | omlx/cluster/launch.py:1558-1568 — both copies are in the same file, so extract the 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 `omlx/cluster/launch.py:1425` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11–13 lines × 2) omlx/patches/glm_moe_dsa/deepseek_v32.py:1075— omlx/patches/glm_moe_dsa/deepseek_v32.py:1075-1087 | omlx/patches/hy_v3/hy_v3_model.py:338-348 — 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (11–12 lines × 2) omlx/cluster/collective.py:147— omlx/cluster/collective.py:147-158 | omlx/cluster/collective.py:237-247 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11–12 lines × 2) omlx/utils/image.py:99— omlx/utils/image.py:99-110 | omlx/utils/image.py:143-153 — both copies are in the same file, so extract the 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 `omlx/utils/image.py:99` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `omlx/utils/image.py:153` calls `except`, `InvalidRequestError` and `omlx/utils/image.py:110` 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 (9–11 lines × 2) omlx/oq.py:7759— omlx/oq.py:7759-7769 | omlx/oq.py:11632-11640 — both copies are in the same file, so extract the 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–11 lines × 2) apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:314— apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:314-322 | apps/omlx-mac/Sources/AppView/Screens/NetworkScreen.swift:94-104 — 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 `apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:314` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with 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 (10–11 lines × 2) omlx/oq.py:8615— omlx/oq.py:8615-8625 | omlx/oq.py:8648-8657 — both copies are in the same file, so extract the 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 `omlx/oq.py:8615` 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 (10–11 lines × 2) apps/omlx-mac/Sources/AppView/Screens/IntegrationsScreen.swift:269— apps/omlx-mac/Sources/AppView/Screens/IntegrationsScreen.swift:269-278 | apps/omlx-mac/Sources/AppView/Screens/IntegrationsScreen.swift:286-296 — both copies are in the same file, so extract the 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 `apps/omlx-mac/Sources/AppView/Screens/IntegrationsScreen.swift:269` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with 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 (8–10 lines × 2) omlx/admin/routes.py:8246— omlx/admin/routes.py:8246-8253 | omlx/admin/routes.py:8272-8281 — both copies are in the same file, so extract the 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 `omlx/admin/routes.py:8272` 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 (8–10 lines × 2) omlx/patches/deepseek_v4/moe_offload.py:284— omlx/patches/deepseek_v4/moe_offload.py:284-293 | omlx/patches/glm_moe_dsa/moe_offload.py:334-341 — `omlx/patches/deepseek_v4/moe_offload.py` and `omlx/patches/glm_moe_dsa/moe_offload.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 10 separate duplicated blocks between them, totalling at least 144 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `omlx/patches/deepseek_v4/moe_offload.py:284` 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 (9 lines × 3) omlx/patches/bailing_hybrid/bailing_hybrid_model.py:308— omlx/patches/bailing_hybrid/bailing_hybrid_model.py:308-316 | omlx/patches/glm_moe_dsa/deepseek_v32.py:562-570 | omlx/patches/glm_moe_dsa/glm_moe_dsa_model.py:398-406 — 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 (9 lines × 3) omlx/patches/mlx_lm_mtp/qwen35_model.py:910— omlx/patches/mlx_lm_mtp/qwen35_model.py:910-918 | omlx/patches/mlx_vlm_mtp/qwen35_moe_vlm_model.py:75-83 | omlx/patches/mlx_vlm_mtp/qwen35_moe_vlm_runtime.py:457-465 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8 lines × 4) omlx/cluster/collective.py:229— omlx/cluster/collective.py:229-236 | omlx/cluster/collective.py:322-329 | omlx/cluster/launch.py:1497-1504 | omlx/cluster/launch.py:1642-1649 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8 lines × 4) REDACTED:5467— REDACTED:5467-5474 | REDACTED:7163-7170 | REDACTED:7714-7721 | REDACTED:8261-8268 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (4–5 lines × 3) omlx/patches/bailing_hybrid/bailing_hybrid_model.py:589— omlx/patches/bailing_hybrid/bailing_hybrid_model.py:589-592 | omlx/patches/glm_moe_dsa/deepseek_v32.py:627-631 | omlx/patches/mimo_v2/mimo_v2_model.py:242-246 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `omlx/patches/glm_moe_dsa/deepseek_v32.py:631` calls `unflatten` and `omlx/patches/bailing_hybrid/bailing_hybrid_model.py:592` does not — after which the two agree again for 5 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (4–5 lines × 3) REDACTED:1807— REDACTED:1807-1811 | REDACTED:4137-4141 | omlx/utils/sampling.py:124-127 — 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 (15 lines × 3) apps/omlx-mac/Sources/AppView/Screens/AccuracyBenchScreen.swift:190— apps/omlx-mac/Sources/AppView/Screens/AccuracyBenchScreen.swift:190-204 | apps/omlx-mac/Sources/AppView/Screens/ContextBenchScreen.swift:110-124 | apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift:189-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 `apps/omlx-mac/Sources/AppView/Screens/AccuracyBenchScreen.swift:190` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 3) apps/omlx-mac/Sources/AppView/Screens/DownloadsScreen.swift:713— apps/omlx-mac/Sources/AppView/Screens/DownloadsScreen.swift:713-727 | apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:651-665 | apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:813-827 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/omlx-mac/Sources/AppView/Screens/DownloadsScreen.swift:713` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 5) apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1116— apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1116-1121 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1147-1152 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2641-2646 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2702-2707 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2764-2769 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1116` 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 × 5) apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2262— apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2262-2267 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2685-2690 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2693-2698 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2746-2751 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2755-2760 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2262` 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 (36 lines × 2 locations) REDACTED:5407— REDACTED:5407 · REDACTED:5561 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (36 lines × 2 locations) REDACTED:5505— REDACTED:5505 · REDACTED:5608 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2 locations) REDACTED:2458— REDACTED:2458 · REDACTED:2629 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2 locations) REDACTED:5642— REDACTED:5642 · REDACTED:5925 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (9 lines × 2 locations) REDACTED:5899— REDACTED:5899 · REDACTED:6511 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (9 lines × 2 locations) REDACTED:7195— REDACTED:7195 · REDACTED:7317 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
AC3 · Page structure· Page without a main landmark · ×1
Page without a main landmark REDACTED:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
AC3 · Page structure· Heading level jumps from h1 to h3 · ×1
Heading level jumps from h1 to h3 apps/omlx-web/omlx_web/templates/chat.html:2719— Skipping heading levels breaks the document outline assistive tech relies on. Don't jump levels — increase by at most one.
AC3 · Page structure· Data table has no header cells · ×1
Data table has no header cells apps/omlx-web/omlx_web/templates/dashboard/_bench.html:322— A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope).
AC4 · Keyboard semantics· Modal dialog does not manage focus · ×1
Modal dialog does not manage focus apps/omlx-web/omlx_web/templates/chat.html:2366— This <div role="dialog"> is a modal dialog, but focus is moved into it, but nothing keeps it there: Tab walks out to the page behind, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
Low contrast Tailwind colour pair (3.8:1) apps/omlx-web/omlx_web/templates/dashboard/_modal_settings_apply.html:25— This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade.
AC7 · A11y enforcement· Accessibility enforcement below the top rung · ×1
Accessibility enforcement below the top rung — No accessibility enforcement found — no accessibility linting at author time and no automated accessibility check in tests or CI. Add your UI toolkit's own accessibility assertion to the test suite (Flutter `meetsGuideline`, Espresso `AccessibilityChecks`, XCTest `performAccessibilityAudit`), then gate that test in the pipeline. What was searched, so you can tell an absence from a miss: the 26 markup file(s) this pass actually assessed, the linter configuration checked in beside them, and this repository's test and CI files — matched by name against the accessibility checkers this dimension carries. An audit run outside the repository, a hosted scanner, or a check whose name is not one of those, is not seen here.
chat.html.chatApp (cyclomatic 412) apps/omlx-web/omlx_web/templates/chat.html:2841— chat.html.chatApp has cyclomatic complexity 412 (threshold 15). Of this number, 381 points are the body's own statements and 31 belong to 13 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
routes.update_global_settings (cyclomatic 290) omlx/admin/routes.py:4872— routes.update_global_settings has cyclomatic complexity 290 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BlockAwarePrefixCache.reconstruct_cache (cyclomatic 252) omlx/cache/prefix_cache.py:3286— BlockAwarePrefixCache.reconstruct_cache has cyclomatic complexity 252 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
routes.update_model_settings (cyclomatic 229) omlx/admin/routes.py:2853— routes.update_model_settings has cyclomatic complexity 229 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
dashboard.dashboard (cyclomatic 159) REDACTED:132— dashboard.dashboard has cyclomatic complexity 159 (threshold 15). Of this number, 100 points are the body's own statements and 59 belong to 11 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
oq.quantize_oq_streaming (cyclomatic 151) omlx/oq.py:6883— oq.quantize_oq_streaming has cyclomatic complexity 151 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ModelSettingsScreenVM.save (cyclomatic 143) apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:866— ModelSettingsScreenVM.save has cyclomatic complexity 143 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
model_loading.maybe_apply_pre_load_patches (cyclomatic 142) omlx/utils/model_loading.py:519— model_loading.maybe_apply_pre_load_patches has cyclomatic complexity 142 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BlockAwarePrefixCache.store_cache (cyclomatic 138) omlx/cache/prefix_cache.py:950— BlockAwarePrefixCache.store_cache has cyclomatic complexity 138 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
VLMBatchedEngine._prepare_vision_inputs (cyclomatic 116) omlx/engine/vlm.py:4045— VLMBatchedEngine._prepare_vision_inputs has cyclomatic complexity 116 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
server.stream_chat_completion (cyclomatic 115) REDACTED:6628— server.stream_chat_completion has cyclomatic complexity 115 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
server.stream_responses_api (cyclomatic 115) REDACTED:9127— server.stream_responses_api has cyclomatic complexity 115 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
oq._build_quant_plan (cyclomatic 113) omlx/oq.py:1301— oq._build_quant_plan has cyclomatic complexity 113 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Scheduler._schedule_waiting (cyclomatic 99) omlx/scheduler.py:13222— Scheduler._schedule_waiting has cyclomatic complexity 99 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
server.stream_anthropic_messages (cyclomatic 98) REDACTED:7351— server.stream_anthropic_messages has cyclomatic complexity 98 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BlockAwarePrefixCache._extract_block_tensor_slice (cyclomatic 96) omlx/cache/prefix_cache.py:2471— BlockAwarePrefixCache._extract_block_tensor_slice has cyclomatic complexity 96 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
routes._build_runtime_cache_observability (cyclomatic 95) omlx/admin/routes.py:6549— routes._build_runtime_cache_observability has cyclomatic complexity 95 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Scheduler._process_batch_responses (cyclomatic 92) omlx/scheduler.py:14081— Scheduler._process_batch_responses has cyclomatic complexity 92 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
dashboard.buildModelSettingsPayload (cyclomatic 91) REDACTED:3490— dashboard.buildModelSettingsPayload has cyclomatic complexity 91 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
dashboard.dashboard.buildModelSettingsPayload (cyclomatic 90) REDACTED:3490— dashboard.dashboard.buildModelSettingsPayload has cyclomatic complexity 90 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Scheduler._do_external_prefill (cyclomatic 89) omlx/scheduler.py:4369— Scheduler._do_external_prefill has cyclomatic complexity 89 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
dashboard.buildModelSettingsState (cyclomatic 87) REDACTED:2155— dashboard.buildModelSettingsState has cyclomatic complexity 87 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PagedSSDCacheManager.save_block (cyclomatic 86) omlx/cache/paged_ssd_cache.py:3454— PagedSSDCacheManager.save_block has cyclomatic complexity 86 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
EnginePool._load_engine (cyclomatic 82) omlx/engine_pool.py:4092— EnginePool._load_engine has cyclomatic complexity 82 (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.
qwen35_ane_prefill.enable_qwen35_ane_prefill (cyclomatic 81) omlx/patches/qwen35_ane_prefill.py:3075— qwen35_ane_prefill.enable_qwen35_ane_prefill has cyclomatic complexity 81 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
routes._build_active_models_data (cyclomatic 80) omlx/admin/routes.py:6976— routes._build_active_models_data has cyclomatic complexity 80 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
oq.universal_quant_predicate (cyclomatic 80) omlx/oq.py:641— oq.universal_quant_predicate has cyclomatic complexity 80 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
VLMBatchedEngine._format_messages_for_vlm_template (cyclomatic 74) omlx/engine/vlm.py:3158— VLMBatchedEngine._format_messages_for_vlm_template has cyclomatic complexity 74 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
routes.cluster_autoconfigure (cyclomatic 71) omlx/cluster/routes.py:1205— routes.cluster_autoconfigure has cyclomatic complexity 71 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ServerScreenVM.applyServerSettings (cyclomatic 71) apps/omlx-mac/Sources/AppView/ViewModels/ServerScreenVM.swift:241— ServerScreenVM.applyServerSettings has cyclomatic complexity 71 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
anthropic_utils.convert_anthropic_to_internal (cyclomatic 68) omlx/api/anthropic_utils.py:189— anthropic_utils.convert_anthropic_to_internal has cyclomatic complexity 68 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
VLMBatchedEngine.start (cyclomatic 68) omlx/engine/vlm.py:1982— VLMBatchedEngine.start has cyclomatic complexity 68 (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.
Scheduler._cleanup_finished (cyclomatic 68) omlx/scheduler.py:14504— Scheduler._cleanup_finished has cyclomatic complexity 68 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GlobalSettings.validate (cyclomatic 68) omlx/settings.py:1685— GlobalSettings.validate has cyclomatic complexity 68 (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.
benchmark.run_benchmark (cyclomatic 62) omlx/admin/benchmark.py:1921— benchmark.run_benchmark has cyclomatic complexity 62 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ProcessMemoryEnforcer._check_and_enforce (cyclomatic 61) omlx/process_memory_enforcer.py:1734— ProcessMemoryEnforcer._check_and_enforce has cyclomatic complexity 61 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ane_tuning._calibrate_fused_components_sync (cyclomatic 60) omlx/admin/ane_tuning.py:1080— ane_tuning._calibrate_fused_components_sync has cyclomatic complexity 60 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
dashboard.dashboard.buildModelSettingsState (cyclomatic 60) REDACTED:2155— dashboard.dashboard.buildModelSettingsState has cyclomatic complexity 60 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
GlobalSettings._apply_cli_overrides (cyclomatic 58) omlx/settings.py:1390— GlobalSettings._apply_cli_overrides has cyclomatic complexity 58 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
tool_calling._parse_tool_calls_impl (cyclomatic 56) omlx/api/tool_calling.py:2050— tool_calling._parse_tool_calls_impl has cyclomatic complexity 56 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
batch_generator._run_verify_cycle_chain (cyclomatic 56) REDACTED:4317— batch_generator._run_verify_cycle_chain has cyclomatic complexity 56 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
server.create_response (cyclomatic 56) REDACTED:8585— server.create_response has cyclomatic complexity 56 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cli.launch_command (cyclomatic 54) REDACTED:465— cli.launch_command has cyclomatic complexity 54 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DistributedBatchedEngine.stream_chat (cyclomatic 54) omlx/engine/distributed.py:1311— DistributedBatchedEngine.stream_chat has cyclomatic complexity 54 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
model_discovery.detect_model_type (cyclomatic 54) omlx/model_discovery.py:710— model_discovery.detect_model_type has cyclomatic complexity 54 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
moe_offload_compat._inspect (cyclomatic 54) omlx/patches/moe_offload_compat.py:46— moe_offload_compat._inspect has cyclomatic complexity 54 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ane_tuning._calibrate_components_sync (cyclomatic 53) omlx/admin/ane_tuning.py:1728— ane_tuning._calibrate_components_sync has cyclomatic complexity 53 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
HFDownloader._run_download (cyclomatic 53) REDACTED:2003— HFDownloader._run_download has cyclomatic complexity 53 (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.
responses_utils.convert_responses_input_to_messages (cyclomatic 53) omlx/api/responses_utils.py:176— responses_utils.convert_responses_input_to_messages has cyclomatic complexity 53 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
probe.collect_cluster_status (cyclomatic 53) omlx/cluster/probe.py:409— probe.collect_cluster_status has cyclomatic complexity 53 (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.
qwen35_ane_prefill._enable_dual_procedure_banks (cyclomatic 53) omlx/patches/qwen35_ane_prefill.py:2463— qwen35_ane_prefill._enable_dual_procedure_banks has cyclomatic complexity 53 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
dashboard.dashboard.formValuesForProfile (cyclomatic 52) REDACTED:1730— dashboard.dashboard.formValuesForProfile has cyclomatic complexity 52 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
dashboard.formValuesForProfile (cyclomatic 52) REDACTED:1730— dashboard.formValuesForProfile has cyclomatic complexity 52 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
EnginePool.get_engine (cyclomatic 50) omlx/engine_pool.py:2698— EnginePool.get_engine has cyclomatic complexity 50 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
oq._forward_layer_result (cyclomatic 50) omlx/oq.py:8585— oq._forward_layer_result has cyclomatic complexity 50 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
server.get_sampling_params (cyclomatic 50) REDACTED:1896— server.get_sampling_params has cyclomatic complexity 50 (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.
GlobalSettings._apply_env_overrides (cyclomatic 50) omlx/settings.py:1224— GlobalSettings._apply_env_overrides has cyclomatic complexity 50 (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.
oq.estimate_bpw_and_size (cyclomatic 49) omlx/oq.py:3971— oq.estimate_bpw_and_size has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DFlashDrafter._draft_batched (cyclomatic 49) omlx/speculative/dflash/drafter.py:591— DFlashDrafter._draft_batched has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
oq._build_model_sanitizer (cyclomatic 47) omlx/oq.py:4706— oq._build_model_sanitizer has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
tool_calling._gemma4_transcode_to_json (cyclomatic 46) omlx/api/tool_calling.py:1561— tool_calling._gemma4_transcode_to_json has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
oq._collect_imatrix_streaming (cyclomatic 46) omlx/oq.py:10472— oq._collect_imatrix_streaming has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Scheduler.step (cyclomatic 46) omlx/scheduler.py:15736— Scheduler.step has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
context_benchmark.run_context_benchmark (cyclomatic 45) omlx/admin/context_benchmark.py:401— context_benchmark.run_context_benchmark has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
runtime._validated_marker (cyclomatic 44) omlx/cluster/runtime.py:418— runtime._validated_marker has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
server.lifespan (cyclomatic 44) REDACTED:509— server.lifespan has cyclomatic complexity 44 (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.
cluster_v2.clusterV2Wizard.checkRows (cyclomatic 44) apps/omlx-web/omlx_web/static/js/cluster_v2.js:2073— cluster_v2.clusterV2Wizard.checkRows has cyclomatic complexity 44 (threshold 15). Of this number, 33 points are the body's own statements and 11 belong to 4 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
clusterV2Wizard.checkRows (cyclomatic 44) apps/omlx-web/omlx_web/static/js/cluster_v2.js:2073— clusterV2Wizard.checkRows has cyclomatic complexity 44 (threshold 15). Of this number, 33 points are the body's own statements and 11 belong to 14 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
accuracy_benchmark.run_accuracy_benchmark (cyclomatic 43) omlx/admin/accuracy_benchmark.py:365— accuracy_benchmark.run_accuracy_benchmark has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ane_tuning.run_tuning (cyclomatic 43) omlx/admin/ane_tuning.py:2102— ane_tuning.run_tuning has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cli.serve_command (cyclomatic 43) REDACTED:173— cli.serve_command has cyclomatic complexity 43 (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.
chat_template_v4.render_message (cyclomatic 43) omlx/patches/deepseek_v4/chat_template_v4.py:291— chat_template_v4.render_message has cyclomatic complexity 43 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
Scheduler._set_model_info_for_monitor (cyclomatic 43) omlx/scheduler.py:16381— Scheduler._set_model_info_for_monitor has cyclomatic complexity 43 (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.
server.create_chat_completion (cyclomatic 43) REDACTED:5034— server.create_chat_completion has cyclomatic complexity 43 (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.
routes.list_models (cyclomatic 42) omlx/admin/routes.py:2390— routes.list_models has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Scheduler._extract_cache_states (cyclomatic 42) omlx/scheduler.py:10391— Scheduler._extract_cache_states has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ModelSettingsScreenVM.enabledFeatures (cyclomatic 42) apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:1598— ModelSettingsScreenVM.enabledFeatures has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
benchmark._run_single_test (cyclomatic 41) omlx/admin/benchmark.py:842— benchmark._run_single_test has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BatchedEngine.start (cyclomatic 41) REDACTED:289— BatchedEngine.start has cyclomatic complexity 41 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
VLMBatchedEngine._iter_diffusion_outputs_sync (cyclomatic 41) omlx/engine/vlm.py:5831— VLMBatchedEngine._iter_diffusion_outputs_sync has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
oq._build_streaming_proxy_for_sensitivity (cyclomatic 41) omlx/oq.py:11553— oq._build_streaming_proxy_for_sensitivity has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SparseCompressedAttention.__call__ (cyclomatic 41) omlx/patches/deepseek_v4/deepseek_v4_model.py:2004— SparseCompressedAttention.__call__ has cyclomatic complexity 41 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
decode_kernels.moe_gate_up_swiglu (cyclomatic 40) omlx/patches/mlx_vlm_glm5_next_compat/decode_kernels.py:798— decode_kernels.moe_gate_up_swiglu has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
anthropic_utils.convert_anthropic_to_internal_harmony (cyclomatic 39) omlx/api/anthropic_utils.py:476— anthropic_utils.convert_anthropic_to_internal_harmony has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
tool_calling.parse_qwen_tool_calls (cyclomatic 39) omlx/api/tool_calling.py:2347— tool_calling.parse_qwen_tool_calls has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
oq._measure_sensitivity_from_quantized_model (cyclomatic 39) omlx/oq.py:11782— oq._measure_sensitivity_from_quantized_model has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
server.get_engine (cyclomatic 39) REDACTED:1470— server.get_engine has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ModelSettingsScreenVM.currentSettingsDict (cyclomatic 39) apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:1756— ModelSettingsScreenVM.currentSettingsDict has cyclomatic complexity 39 (threshold 15). Of this number, 34 points are the body's own statements and 5 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
dashboard.accDownloadResult (cyclomatic 39) REDACTED:6531— dashboard.accDownloadResult has cyclomatic complexity 39 (threshold 15). Of this number, 36 points are the body's own statements and 3 belong to 12 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
autoconfigure.choose_parallelism (cyclomatic 38) omlx/cluster/autoconfigure.py:142— autoconfigure.choose_parallelism has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
decode_kernels.kda_decode_step (cyclomatic 38) omlx/patches/mlx_vlm_glm5_next_compat/decode_kernels.py:2373— decode_kernels.kda_decode_step has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Scheduler.__init__ (cyclomatic 38) omlx/scheduler.py:2198— Scheduler.__init__ has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
dashboard.dashboard.accDownloadResult (cyclomatic 38) REDACTED:6531— dashboard.dashboard.accDownloadResult has cyclomatic complexity 38 (threshold 15). Of this number, 35 points are the body's own statements and 3 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
gemma4.extract_gemma4_messages (cyclomatic 37) omlx/adapter/gemma4.py:73— gemma4.extract_gemma4_messages has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PagedSSDCacheManager._reconstruct_cache_data (cyclomatic 37) omlx/cache/paged_ssd_cache.py:3978— PagedSSDCacheManager._reconstruct_cache_data has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
launch._sweep_rank_processes (cyclomatic 37) omlx/cluster/launch.py:651— launch._sweep_rank_processes has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Indexer.__call__ (cyclomatic 37) omlx/patches/glm_moe_dsa/deepseek_v32.py:214— Indexer.__call__ has cyclomatic complexity 37 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
Scheduler._do_abort_request (cyclomatic 37) omlx/scheduler.py:12294— Scheduler._do_abort_request has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
server.init_server (cyclomatic 37) REDACTED:2485— server.init_server has cyclomatic complexity 37 (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.
BlockAwarePrefixCache._get_cache_seq_len (cyclomatic 36) omlx/cache/prefix_cache.py:2012— BlockAwarePrefixCache._get_cache_seq_len has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
routes.replan_cluster_deployment (cyclomatic 36) omlx/cluster/routes.py:3842— routes.replan_cluster_deployment has cyclomatic complexity 36 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
server.list_models (cyclomatic 36) REDACTED:3804— server.list_models has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
image._extract_media (cyclomatic 36) omlx/utils/image.py:352— image._extract_media has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PerformanceScreenVM.save (cyclomatic 36) apps/omlx-mac/Sources/AppView/ViewModels/PerformanceScreenVM.swift:223— PerformanceScreenVM.save has cyclomatic complexity 36 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
dashboard.saveGlobalSettings (cyclomatic 36) REDACTED:1402— dashboard.saveGlobalSettings has cyclomatic complexity 36 (threshold 15). Of this number, 33 points are the body's own statements and 3 belong to 4 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ane_tuning._measure_candidate (cyclomatic 35) omlx/admin/ane_tuning.py:591— ane_tuning._measure_candidate 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.
PairingManager.handle_join_request (cyclomatic 35) REDACTED:1224— PairingManager.handle_join_request has cyclomatic complexity 35 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
dashboard.dashboard.saveGlobalSettings (cyclomatic 35) REDACTED:1402— dashboard.dashboard.saveGlobalSettings has cyclomatic complexity 35 (threshold 15). Of this number, 34 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
oq._collect_imatrix_from_model (cyclomatic 34) omlx/oq.py:9520— oq._collect_imatrix_from_model has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
routes.list_hf_models (cyclomatic 33) omlx/admin/routes.py:8202— routes.list_hf_models has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
routes.delete_hf_model (cyclomatic 33) omlx/admin/routes.py:8344— routes.delete_hf_model has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
deepseek_v41_delta.restore_chain (cyclomatic 33) omlx/cache/deepseek_v41_delta.py:87— deepseek_v41_delta.restore_chain has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BlockAwarePrefixCache._maybe_backfill_dedup_block_payload (cyclomatic 33) omlx/cache/prefix_cache.py:2333— BlockAwarePrefixCache._maybe_backfill_dedup_block_payload has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PairingManager.complete_join (cyclomatic 33) REDACTED:1072— PairingManager.complete_join has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
progressive_loading.progressive_sharded_load (cyclomatic 33) omlx/cluster/progressive_loading.py:74— progressive_loading.progressive_sharded_load has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
EnginePool._engine_runtime_signature (cyclomatic 33) omlx/engine_pool.py:1250— EnginePool._engine_runtime_signature has cyclomatic complexity 33 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Scheduler._plan_prefill_rows (cyclomatic 33) omlx/scheduler.py:7737— Scheduler._plan_prefill_rows has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Scheduler._get_boundary_store_override (cyclomatic 33) omlx/scheduler.py:9581— Scheduler._get_boundary_store_override has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
dashboard.dashboard.validateQwenAneSettings (cyclomatic 33) REDACTED:3413— dashboard.dashboard.validateQwenAneSettings has cyclomatic complexity 33 (threshold 15). Of this number, 22 points are the body's own statements and 11 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
dashboard.validateQwenAneSettings (cyclomatic 33) REDACTED:3413— dashboard.validateQwenAneSettings has cyclomatic complexity 33 (threshold 15). Of this number, 22 points are the body's own statements and 11 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
tool_calling._coerce_param_value (cyclomatic 32) omlx/api/tool_calling.py:342— tool_calling._coerce_param_value has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ClusterDeployment.__post_init__ (cyclomatic 32) omlx/cluster/deployment.py:369— ClusterDeployment.__post_init__ has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
prompt_priming._capture_single (cyclomatic 32) REDACTED:1100— prompt_priming._capture_single has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MenubarIconRecovery.fixStatusKitPermission (cyclomatic 32) apps/omlx-mac/Sources/Menubar/MenubarVisibilityWatcher.swift:368— MenubarIconRecovery.fixStatusKitPermission has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
benchmark._upload_to_omlx_ai (cyclomatic 31) omlx/admin/benchmark.py:1640— benchmark._upload_to_omlx_ai has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
HFDownloader.search_models (cyclomatic 31) REDACTED:1463— HFDownloader.search_models has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
OQManager.start_quantization (cyclomatic 31) omlx/admin/oq_manager.py:304— OQManager.start_quantization has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
discovery_routes._enrich_paired_row (cyclomatic 31) omlx/cluster/discovery_routes.py:213— discovery_routes._enrich_paired_row has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
planner.inspect_safetensors_layout (cyclomatic 31) omlx/cluster/planner.py:1251— planner.inspect_safetensors_layout has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
planner.plan_hybrid (cyclomatic 31) omlx/cluster/planner.py:2267— planner.plan_hybrid has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
runtime._validated_metrics (cyclomatic 31) omlx/cluster/runtime.py:196— runtime._validated_metrics has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
transport.assess_link (cyclomatic 31) omlx/cluster/transport.py:890— transport.assess_link has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
VLMModelAdapter.__call__ (cyclomatic 31) omlx/models/vlm.py:613— VLMModelAdapter.__call__ has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SwitchGLU.__call__ (cyclomatic 31) omlx/patches/deepseek_v4/switch_layers.py:482— SwitchGLU.__call__ has cyclomatic complexity 31 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
Scheduler._prepare_prefix_cache_for_request (cyclomatic 31) omlx/scheduler.py:11020— Scheduler._prepare_prefix_cache_for_request has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Scheduler._route_to_vlm_mtp (cyclomatic 31) omlx/scheduler.py:11496— Scheduler._route_to_vlm_mtp has cyclomatic complexity 31 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
server._prepare_anthropic_prompt (cyclomatic 31) REDACTED:7828— server._prepare_anthropic_prompt has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
dashboard.sortedModels (cyclomatic 31) REDACTED:7191— dashboard.sortedModels has cyclomatic complexity 31 (threshold 15). Most of this is not in the body itself: 1 of the 31 points is its own statement and the rest belongs to one function literal inside it that branches (line 7192). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
benchmark._log_ane_benchmark_trace (cyclomatic 30) omlx/admin/benchmark.py:1032— benchmark._log_ane_benchmark_trace 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.
routes._feature_problem (cyclomatic 30) omlx/admin/routes.py:4001— routes._feature_problem 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.
routes.probe_cache (cyclomatic 30) omlx/admin/routes.py:7731— routes.probe_cache has cyclomatic complexity 30 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
DistributedBatchedEngine.stream_generate (cyclomatic 30) omlx/engine/distributed.py:1661— DistributedBatchedEngine.stream_generate 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.
model_discovery._missing_weight_shards (cyclomatic 30) omlx/model_discovery.py:1270— model_discovery._missing_weight_shards 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.
Scheduler._advance_chunked_prefills (cyclomatic 30) omlx/scheduler.py:7920— Scheduler._advance_chunked_prefills 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.
Scheduler._buffer_stop_sequence_output (cyclomatic 30) omlx/scheduler.py:8169— Scheduler._buffer_stop_sequence_output 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.
affine4._native_attention (cyclomatic 29) omlx/affine4.py:767— affine4._native_attention has cyclomatic complexity 29 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
audio_routes._run_realtime_voice (cyclomatic 29) omlx/api/audio_routes.py:1139— audio_routes._run_realtime_voice has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ToolCallStreamFilter._advance_json_scan (cyclomatic 29) omlx/api/tool_calling.py:2897— ToolCallStreamFilter._advance_json_scan has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ToolCallStreamFilter.feed (cyclomatic 29) omlx/api/tool_calling.py:3557— ToolCallStreamFilter.feed has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BoundarySnapshotSSDStore._process_write_item (cyclomatic 29) omlx/cache/boundary_snapshot_store.py:1072— BoundarySnapshotSSDStore._process_write_item has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
launch.build_mlx_launch_argv (cyclomatic 29) omlx/cluster/launch.py:1188— launch.build_mlx_launch_argv has cyclomatic complexity 29 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
routes._activate_and_report (cyclomatic 29) omlx/cluster/routes.py:3479— routes._activate_and_report has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
VLMBatchedEngine._try_build_cached_vision_inputs (cyclomatic 29) omlx/engine/vlm.py:3679— VLMBatchedEngine._try_build_cached_vision_inputs has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PipelinedTextModel.__call__ (cyclomatic 29) omlx/patches/glm5_next_mlx_lm/model.py:86— PipelinedTextModel.__call__ has cyclomatic complexity 29 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
fused_batch._advance_group (cyclomatic 29) omlx/patches/mlx_lm_mtp/fused_batch.py:126— fused_batch._advance_group has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
decode_kernels.moe_down_combine (cyclomatic 29) omlx/patches/mlx_vlm_glm5_next_compat/decode_kernels.py:936— decode_kernels.moe_down_combine has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Scheduler._run_prefill_chunks (cyclomatic 29) omlx/scheduler.py:7200— Scheduler._run_prefill_chunks has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Scheduler._normalize_rotating_snapshot_state (cyclomatic 29) omlx/scheduler.py:10261— Scheduler._normalize_rotating_snapshot_state has cyclomatic complexity 29 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
dashboard.prefillHelperStatusText (cyclomatic 29) REDACTED:3284— dashboard.prefillHelperStatusText has cyclomatic complexity 29 (threshold 15). Of this number, 28 points are the body's own statements and 1 belongs to 3 function items inside it that branch. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
paged_ssd_cache._block_cachelist_subtypes (cyclomatic 28) omlx/cache/paged_ssd_cache.py:585— paged_ssd_cache._block_cachelist_subtypes has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
runtime_optimizations.install_runtime_optimizations (cyclomatic 28) omlx/cluster/runtime_optimizations.py:274— runtime_optimizations.install_runtime_optimizations has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
VLMBatchedEngine._compute_vision_features (cyclomatic 28) omlx/engine/vlm.py:3458— VLMBatchedEngine._compute_vision_features has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
EnginePool._stop_and_unload_engine (cyclomatic 28) omlx/engine_pool.py:3758— EnginePool._stop_and_unload_engine has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
oq._discover_sanitize_plan (cyclomatic 28) omlx/oq.py:3176— oq._discover_sanitize_plan has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Model.sanitize (cyclomatic 28) omlx/patches/mimo_v2/mimo_v2_model.py:598— Model.sanitize has cyclomatic complexity 28 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
cluster_v2.clusterV2Wizard.runPlan (cyclomatic 28) apps/omlx-web/omlx_web/static/js/cluster_v2.js:2819— cluster_v2.clusterV2Wizard.runPlan has cyclomatic complexity 28 (threshold 15). Of this number, 25 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
clusterV2Wizard.runPlan (cyclomatic 28) apps/omlx-web/omlx_web/static/js/cluster_v2.js:2819— clusterV2Wizard.runPlan has cyclomatic complexity 28 (threshold 15). Of this number, 25 points are the body's own statements and 3 belong to 6 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
model_recommender.kv_cache_cost (cyclomatic 27) omlx/admin/model_recommender.py:647— model_recommender.kv_cache_cost has cyclomatic complexity 27 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
MSDownloader._run_download (cyclomatic 27) omlx/admin/ms_downloader.py:902— MSDownloader._run_download 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.
PagedSSDCacheManager._is_compatible_cache_signature (cyclomatic 27) omlx/cache/paged_ssd_cache.py:2860— PagedSSDCacheManager._is_compatible_cache_signature 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.
DistributedJobSupervisor._terminate (cyclomatic 27) omlx/cluster/launch.py:3073— DistributedJobSupervisor._terminate 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.
launch.preflight_remote_hosts (cyclomatic 27) omlx/cluster/launch.py:2392— launch.preflight_remote_hosts 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.
model_discovery.discover_models (cyclomatic 27) omlx/model_discovery.py:1994— model_discovery.discover_models 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.
ModelSettingsManager._repair_profile_references (cyclomatic 27) omlx/model_settings.py:732— ModelSettingsManager._repair_profile_references 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.
MLXEmbeddingModel.embed (cyclomatic 27) omlx/models/embedding.py:957— MLXEmbeddingModel.embed has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
MLXRerankerModel._resolve_token_id (cyclomatic 27) omlx/models/reranker.py:549— MLXRerankerModel._resolve_token_id 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.
m5_gather_qmm_nax.supports (cyclomatic 27) omlx/patches/m5_gather_qmm_nax.py:1322— m5_gather_qmm_nax.supports 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.
glm5_next_batch_rollback.rollback_rows (cyclomatic 27) omlx/patches/mlx_vlm_mtp/glm5_next_batch_rollback.py:10— glm5_next_batch_rollback.rollback_rows 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.
server._with_sse_keepalive (cyclomatic 27) REDACTED:3073— server._with_sse_keepalive 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.
server.stream_completion (cyclomatic 27) REDACTED:6085— server.stream_completion 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.
ModelSettingsScreenVM.validateAneWorkingSettings (cyclomatic 27) apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:2293— ModelSettingsScreenVM.validateAneWorkingSettings has cyclomatic complexity 27 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
TalkAIController.handle (cyclomatic 27) apps/omlx-mac/Sources/AskAI/TalkAIController.swift:331— TalkAIController.handle 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.
routes._delete_gguf_model (cyclomatic 26) omlx/admin/routes.py:8502— routes._delete_gguf_model 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.
PagedSSDCacheManager.load_block_with_metadata (cyclomatic 26) omlx/cache/paged_ssd_cache.py:4365— PagedSSDCacheManager.load_block_with_metadata 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.
DiscoveryService._probe_candidate (cyclomatic 26) REDACTED:1848— DiscoveryService._probe_candidate 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.
stage_transport.install_stage_links (cyclomatic 26) omlx/cluster/rdma/stage_transport.py:218— stage_transport.install_stage_links 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.
memory_monitor.set_model_info_from_model (cyclomatic 26) REDACTED:2125— memory_monitor.set_model_info_from_model 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.
oq._load_hf_calibration (cyclomatic 26) omlx/oq.py:8156— oq._load_hf_calibration 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.
moe_expert_offload.estimate_offload_admission_bytes (cyclomatic 26) omlx/patches/moe_expert_offload.py:1172— moe_expert_offload.estimate_offload_admission_bytes 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.
qwen35_ane_prefill._compile_gdn (cyclomatic 26) omlx/patches/qwen35_ane_prefill.py:1112— qwen35_ane_prefill._compile_gdn 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.
Model.sanitize (cyclomatic 26) omlx/patches/raon1_mini/raon1_mini_model.py:1932— Model.sanitize has cyclomatic complexity 26 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
dashboard.applyANETuningRecommendation (cyclomatic 26) REDACTED:2919— dashboard.applyANETuningRecommendation 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.
ane_tuning._profile_refinement (cyclomatic 25) omlx/admin/ane_tuning.py:802— ane_tuning._profile_refinement has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BlockAwarePrefixCache._validate_block_cache_data (cyclomatic 25) omlx/cache/prefix_cache.py:5242— BlockAwarePrefixCache._validate_block_cache_data has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cli.cluster_command (cyclomatic 25) REDACTED:947— cli.cluster_command has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DiscoveryService._handle_mdns_service (cyclomatic 25) REDACTED:2108— DiscoveryService._handle_mdns_service 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.
discovery_routes.cluster_devices (cyclomatic 25) omlx/cluster/discovery_routes.py:305— discovery_routes.cluster_devices 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.
inference_worker.run_worker (cyclomatic 25) omlx/cluster/inference_worker.py:1308— inference_worker.run_worker 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.
launch.run_cuda_fabric_probe (cyclomatic 25) omlx/cluster/launch.py:1526— launch.run_cuda_fabric_probe 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.
PairingManager.approve (cyclomatic 25) REDACTED:1341— PairingManager.approve has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
planner._partition_layers (cyclomatic 25) omlx/cluster/planner.py:1547— planner._partition_layers has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
EnginePool._entry_runtime_resident_size (cyclomatic 25) omlx/engine_pool.py:601— EnginePool._entry_runtime_resident_size has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
d3.decode_video (cyclomatic 25) omlx/models/d3.py:302— d3.decode_video has cyclomatic complexity 25 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
_DiscoveredPlan.pop (cyclomatic 25) omlx/oq.py:3775— _DiscoveredPlan.pop 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.
oq._lookup_imatrix_importance (cyclomatic 25) omlx/oq.py:6366— oq._lookup_imatrix_importance has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Indexer.__call__ (cyclomatic 25) omlx/patches/deepseek_v4/deepseek_v4_model.py:1364— Indexer.__call__ has cyclomatic complexity 25 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
GlmMoeDsaAttention.__call__ (cyclomatic 25) omlx/patches/glm_moe_dsa/glm_moe_dsa_model.py:185— GlmMoeDsaAttention.__call__ has cyclomatic complexity 25 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
ModelArgs.__post_init__ (cyclomatic 25) omlx/patches/laguna/laguna_model.py:144— ModelArgs.__post_init__ 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.
sdpa_flash.sdpa_flash (cyclomatic 25) omlx/patches/mimo_v2/sdpa_flash.py:418— sdpa_flash.sdpa_flash 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.
batch_generator._chain_next_drafts (cyclomatic 25) REDACTED:3169— batch_generator._chain_next_drafts has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
prompt_priming.maybe_capture (cyclomatic 25) REDACTED:877— prompt_priming.maybe_capture has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
qwen35_ane_prefill._backend_exact (cyclomatic 25) omlx/patches/qwen35_ane_prefill.py:1762— qwen35_ane_prefill._backend_exact has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Scheduler._detect_needs_think_prefix (cyclomatic 25) omlx/scheduler.py:8836— Scheduler._detect_needs_think_prefix has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
model_loading.expand_per_layer_quant_keys (cyclomatic 25) omlx/utils/model_loading.py:185— model_loading.expand_per_layer_quant_keys has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ExperimentalSection.body (cyclomatic 25) apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2494— ExperimentalSection.body has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
dashboard.dashboard.applyANETuningRecommendation (cyclomatic 25) REDACTED:2919— dashboard.dashboard.applyANETuningRecommendation has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
dashboard.dashboard.prefillHelperStatusText (cyclomatic 25) REDACTED:3284— dashboard.dashboard.prefillHelperStatusText has cyclomatic complexity 25 (threshold 15). Of this number, 24 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
MSDownloader.get_model_info (cyclomatic 24) omlx/admin/ms_downloader.py:588— MSDownloader.get_model_info has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
routes.clear_ssd_cache (cyclomatic 24) omlx/admin/routes.py:7414— routes.clear_ssd_cache has cyclomatic complexity 24 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
audio_routes.create_transcription (cyclomatic 24) omlx/api/audio_routes.py:513— audio_routes.create_transcription has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
LFM3VoiceBackend._slot (cyclomatic 24) omlx/engine/lfm3_realtime.py:311— LFM3VoiceBackend._slot has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
engine_pool._qwen35_cpu_share_estimated_bytes (cyclomatic 24) omlx/engine_pool.py:198— engine_pool._qwen35_cpu_share_estimated_bytes has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
BaseBenchmark.run (cyclomatic 24) omlx/eval/base.py:350— BaseBenchmark.run has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
oq._quantize_chunked (cyclomatic 24) omlx/oq.py:6774— oq._quantize_chunked has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CompressedAttention.__call__ (cyclomatic 24) omlx/patches/deepseek_v4/deepseek_v4_model.py:1833— CompressedAttention.__call__ has cyclomatic complexity 24 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
deepseek_v4_model._sparse_pooled_attention (cyclomatic 24) omlx/patches/deepseek_v4/deepseek_v4_model.py:789— deepseek_v4_model._sparse_pooled_attention has cyclomatic complexity 24 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
_DepthController.observe (cyclomatic 24) REDACTED:2768— _DepthController.observe has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
qwen35_q4_mlp._is_supported_affine_linear_shape (cyclomatic 24) omlx/patches/qwen35_q4_mlp.py:140— qwen35_q4_mlp._is_supported_affine_linear_shape has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
cluster_v2.clusterV2Wizard.wizardState (cyclomatic 24) apps/omlx-web/omlx_web/static/js/cluster_v2.js:1069— cluster_v2.clusterV2Wizard.wizardState has cyclomatic complexity 24 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
cluster_v2.clusterV2Wizard.previewMembershipExpansion (cyclomatic 24) apps/omlx-web/omlx_web/static/js/cluster_v2.js:3517— cluster_v2.clusterV2Wizard.previewMembershipExpansion has cyclomatic complexity 24 (threshold 15). Of this number, 19 points are the body's own statements and 5 belong to 3 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
logs.aggregateLogRows (cyclomatic 24) REDACTED:71— logs.aggregateLogRows has cyclomatic complexity 24 (threshold 15). Of this number, 20 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
clusterV2Wizard.wizardState (cyclomatic 24) apps/omlx-web/omlx_web/static/js/cluster_v2.js:1069— clusterV2Wizard.wizardState has cyclomatic complexity 24 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
clusterV2Wizard.previewMembershipExpansion (cyclomatic 24) apps/omlx-web/omlx_web/static/js/cluster_v2.js:3517— clusterV2Wizard.previewMembershipExpansion has cyclomatic complexity 24 (threshold 15). Of this number, 19 points are the body's own statements and 5 belong to 6 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
paged_ssd_cache._load_nstate_flat (cyclomatic 23) omlx/cache/paged_ssd_cache.py:823— paged_ssd_cache._load_nstate_flat 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.
runtime._validated_assignments (cyclomatic 23) omlx/cluster/runtime.py:91— runtime._validated_assignments 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.
staging.stage_files_from_source (cyclomatic 23) omlx/cluster/staging.py:1000— staging.stage_files_from_source 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.
EnginePool.resolve_model_id (cyclomatic 23) omlx/engine_pool.py:1981— EnginePool.resolve_model_id 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.
qwen35_fa256_attention.apply_qwen35_fa256_attention_patch (cyclomatic 23) omlx/patches/qwen35_fa256_attention.py:323— qwen35_fa256_attention.apply_qwen35_fa256_attention_patch 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.
Scheduler._prepare_prompt_boundary_cache_store (cyclomatic 23) omlx/scheduler.py:10045— Scheduler._prepare_prompt_boundary_cache_store 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.
target.run_specprefill_target_prefill (cyclomatic 23) omlx/specprefill/target.py:57— target.run_specprefill_target_prefill 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.
AdvancedPage.body (cyclomatic 23) apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1219— AdvancedPage.body 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.
cluster_v2.clusterV2Wizard.acceleratorRows (cyclomatic 23) apps/omlx-web/omlx_web/static/js/cluster_v2.js:1898— cluster_v2.clusterV2Wizard.acceleratorRows has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 2 of the 23 points are its own statements and the rest belongs to 2 function items inside it that branch (a function literal at line 1903, size). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
dashboard.dashboard.openModelSettings (cyclomatic 23) REDACTED:3011— dashboard.dashboard.openModelSettings has cyclomatic complexity 23 (threshold 15). Of this number, 22 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
clusterV2Wizard.acceleratorRows (cyclomatic 23) apps/omlx-web/omlx_web/static/js/cluster_v2.js:1898— clusterV2Wizard.acceleratorRows has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 2 of the 23 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 1903, size, t). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
dashboard.openModelSettings (cyclomatic 23) REDACTED:3011— dashboard.openModelSettings has cyclomatic complexity 23 (threshold 15). Of this number, 22 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
audio_routes._split_tts_text (cyclomatic 22) omlx/api/audio_routes.py:284— audio_routes._split_tts_text has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
audio_routes.realtime_voice (cyclomatic 22) omlx/api/audio_routes.py:1001— audio_routes.realtime_voice has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
BoundarySnapshotSSDStore._serialize_extracted (cyclomatic 22) omlx/cache/boundary_snapshot_store.py:1212— BoundarySnapshotSSDStore._serialize_extracted has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
pooling_delta.compact_pooling_cache_snapshot (cyclomatic 22) omlx/cache/pooling_delta.py:22— pooling_delta.compact_pooling_cache_snapshot has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
launch.stop_deployment_processes (cyclomatic 22) omlx/cluster/launch.py:827— launch.stop_deployment_processes has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
launch.probe_remote_host (cyclomatic 22) omlx/cluster/launch.py:2212— launch.probe_remote_host has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PairingSession._begin (cyclomatic 22) omlx/cluster/pairing_session.py:198— PairingSession._begin has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
routes.cluster_cuda_fabric_verify (cyclomatic 22) omlx/cluster/routes.py:2681— routes.cluster_cuda_fabric_verify has cyclomatic complexity 22 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
transport.detect_transports (cyclomatic 22) omlx/cluster/transport.py:236— transport.detect_transports has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
EnginePool._evict_idle_lru_for_prefill (cyclomatic 22) omlx/engine_pool.py:3238— EnginePool._evict_idle_lru_for_prefill has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ModelSettingsManager._load_profiles (cyclomatic 22) omlx/model_settings.py:1131— ModelSettingsManager._load_profiles has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
oq.import_mtplx_sidecar (cyclomatic 22) omlx/oq.py:2285— oq.import_mtplx_sidecar has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BatchPoolingCache.accumulate_windows (cyclomatic 22) omlx/patches/deepseek_v4/cache_extras.py:515— BatchPoolingCache.accumulate_windows has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
m5_gather_qmm_a8._launch (cyclomatic 22) omlx/patches/m5_gather_qmm_a8.py:822— m5_gather_qmm_a8._launch has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
prompt_priming._prepare_prefix_context (cyclomatic 22) REDACTED:601— prompt_priming._prepare_prefix_context has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
qwen35_ane_prefill._compile_pair (cyclomatic 22) omlx/patches/qwen35_ane_prefill.py:597— qwen35_ane_prefill._compile_pair has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PrefillHelperManager._run (cyclomatic 22) omlx/prefill_helper/manager.py:519— PrefillHelperManager._run has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Scheduler._build_sampler_and_processors (cyclomatic 22) omlx/scheduler.py:8459— Scheduler._build_sampler_and_processors has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Scheduler._validate_cache (cyclomatic 22) omlx/scheduler.py:10191— Scheduler._validate_cache has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GlobalSettings._load_from_file (cyclomatic 22) omlx/settings.py:1145— GlobalSettings._load_from_file has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
UpdateController.runCheck (cyclomatic 22) apps/omlx-mac/Sources/Updater/UpdateController.swift:312— UpdateController.runCheck has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
dashboard.dashboard.saveModelSettings (cyclomatic 22) REDACTED:3729— dashboard.dashboard.saveModelSettings has cyclomatic complexity 22 (threshold 15). Of this number, 19 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
dashboard.saveModelSettings (cyclomatic 22) REDACTED:3729— dashboard.saveModelSettings has cyclomatic complexity 22 (threshold 15). Of this number, 19 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
accuracy_upload.trim_question_results (cyclomatic 21) omlx/admin/accuracy_upload.py:147— accuracy_upload.trim_question_results has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ane_tuning._settings_for_candidate (cyclomatic 21) omlx/admin/ane_tuning.py:445— ane_tuning._settings_for_candidate has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ExternalAPIClient.stream_chat_completion (cyclomatic 21) omlx/admin/external_api.py:368— ExternalAPIClient.stream_chat_completion has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
recipe.decode_recipe (cyclomatic 21) omlx/admin/recipe.py:60— recipe.decode_recipe has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
audio_routes.realtime_transcription (cyclomatic 21) omlx/api/audio_routes.py:693— audio_routes.realtime_transcription has cyclomatic complexity 21 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
ThinkingParser.feed (cyclomatic 21) omlx/api/thinking.py:321— ThinkingParser.feed has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BoundarySnapshotSSDStore._write_inline (cyclomatic 21) omlx/cache/boundary_snapshot_store.py:939— BoundarySnapshotSSDStore._write_inline has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
base._run_scheduler_preflight_with_cleanup_retry (cyclomatic 21) omlx/engine/base.py:87— base._run_scheduler_preflight_with_cleanup_retry has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
memory_monitor._make_deepseek_v41_prefill_memory_profile (cyclomatic 21) REDACTED:1754— memory_monitor._make_deepseek_v41_prefill_memory_profile has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MLXRerankerModel._rerank_jina (cyclomatic 21) omlx/models/reranker.py:1149— MLXRerankerModel._rerank_jina has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
oq._collect_mtp_head_imatrix (cyclomatic 21) omlx/oq.py:9413— oq._collect_mtp_head_imatrix has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
m5_gather_qmm_a8.supports (cyclomatic 21) omlx/patches/m5_gather_qmm_a8.py:761— m5_gather_qmm_a8.supports has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
batched_head.draft (cyclomatic 21) omlx/patches/mlx_lm_mtp/batched_head.py:90— batched_head.draft has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Scheduler._find_relevant_inflight_store (cyclomatic 21) omlx/scheduler.py:10806— Scheduler._find_relevant_inflight_store has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Scheduler._align_minimax_m3_partial_cache_to_prefill_step (cyclomatic 21) omlx/scheduler.py:12027— Scheduler._align_minimax_m3_partial_cache_to_prefill_step has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
dashboard.dashboard.handleMainTabChange (cyclomatic 21) REDACTED:890— dashboard.dashboard.handleMainTabChange has cyclomatic complexity 21 (threshold 15). Of this number, 19 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
dashboard.handleMainTabChange (cyclomatic 21) REDACTED:890— dashboard.handleMainTabChange has cyclomatic complexity 21 (threshold 15). Of this number, 19 points are the body's own statements and 2 belong to 4 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
harmony.parse_tool_calls_from_tokens (cyclomatic 20) omlx/adapter/harmony.py:428— harmony.parse_tool_calls_from_tokens 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.
output_parser.detect_output_parser (cyclomatic 20) omlx/adapter/output_parser.py:1369— output_parser.detect_output_parser 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.
HFDownloader.get_model_info (cyclomatic 20) REDACTED:1590— HFDownloader.get_model_info 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.
HFDownloader._poll_progress (cyclomatic 20) REDACTED:2376— HFDownloader._poll_progress 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.
HFUploader._run_upload (cyclomatic 20) omlx/admin/hf_uploader.py:673— HFUploader._run_upload 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.
OQManager._run_quantization (cyclomatic 20) omlx/admin/oq_manager.py:599— OQManager._run_quantization 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.
audio_routes.create_speech (cyclomatic 20) omlx/api/audio_routes.py:1529— audio_routes.create_speech has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
ToolCallStreamFilter._should_drop_tail_at_finish (cyclomatic 20) omlx/api/tool_calling.py:3349— ToolCallStreamFilter._should_drop_tail_at_finish 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.
BoundarySnapshotSSDStore._read_state_tuple_raw (cyclomatic 20) omlx/cache/boundary_snapshot_store.py:1786— BoundarySnapshotSSDStore._read_state_tuple_raw 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.
BoundarySnapshotSSDStore._read_state_tuple_arrays (cyclomatic 20) omlx/cache/boundary_snapshot_store.py:1948— BoundarySnapshotSSDStore._read_state_tuple_arrays 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.
PagedSSDCacheManager.signature_mismatch_reason (cyclomatic 20) omlx/cache/paged_ssd_cache.py:2969— PagedSSDCacheManager.signature_mismatch_reason 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.
PagedSSDCacheManager.load_block (cyclomatic 20) omlx/cache/paged_ssd_cache.py:4207— PagedSSDCacheManager.load_block 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.
PagedSSDCacheManager.invalidate_stale_layer_signature (cyclomatic 20) omlx/cache/paged_ssd_cache.py:4836— PagedSSDCacheManager.invalidate_stale_layer_signature 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.
probe.detect_accelerator_hardware (cyclomatic 20) omlx/cluster/probe.py:72— probe.detect_accelerator_hardware 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.
DeviceRegistry._coerce (cyclomatic 20) omlx/cluster/registry.py:436— DeviceRegistry._coerce 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.
routes._run_staging_job (cyclomatic 20) omlx/cluster/routes.py:1728— routes._run_staging_job 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.
DistributedBatchedEngine._write_rank_cancel_request (cyclomatic 20) omlx/engine/distributed.py:1072— DistributedBatchedEngine._write_rank_cancel_request 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.
VLMBatchedEngine._split_vision_features (cyclomatic 20) omlx/engine/vlm.py:3828— VLMBatchedEngine._split_vision_features 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.
vlm._audio_feature_cache_key_ranges (cyclomatic 20) omlx/engine/vlm.py:1627— vlm._audio_feature_cache_key_ranges 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.
model_discovery._register_model (cyclomatic 20) omlx/model_discovery.py:1702— model_discovery._register_model 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.
_LazyTensorIndex._discover_fp8_pairs (cyclomatic 20) omlx/oq.py:5533— _LazyTensorIndex._discover_fp8_pairs 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.
BatchPoolingCache.merge (cyclomatic 20) omlx/patches/deepseek_v4/cache_extras.py:1147— BatchPoolingCache.merge has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
batch_generator._post_init_mtp (cyclomatic 20) REDACTED:3343— batch_generator._post_init_mtp 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.
norm_repair.repair_legacy_head_norms (cyclomatic 20) omlx/patches/mlx_lm_mtp/norm_repair.py:51— norm_repair.repair_legacy_head_norms 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.
qwen38_modelopt_mixed.transform_weights_exact (cyclomatic 20) omlx/patches/qwen38_modelopt_mixed.py:283— qwen38_modelopt_mixed.transform_weights_exact 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.
Scheduler._init_tiered_cache (cyclomatic 20) omlx/scheduler.py:16784— Scheduler._init_tiered_cache 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.
websearch.run_fetch_url (cyclomatic 20) omlx/websearch.py:591— websearch.run_fetch_url 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.
ProfileGroup.chip (cyclomatic 20) apps/omlx-mac/Sources/AppView/Screens/ProfileViews.swift:181— ProfileGroup.chip 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.
dashboard.dashboard.sortModels (cyclomatic 20) REDACTED:8726— dashboard.dashboard.sortModels has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 2 of the 20 points are its own statements and the rest belongs to one function literal inside it that branches (line 8729). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
dashboard.sortModels (cyclomatic 20) REDACTED:8726— dashboard.sortModels has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 2 of the 20 points are its own statements and the rest belongs to one function literal inside it that branches (line 8729). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
benchmark._filter_uploaded_settings (cyclomatic 19) omlx/admin/benchmark.py:432— benchmark._filter_uploaded_settings 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.
routes.clear_hot_cache (cyclomatic 19) omlx/admin/routes.py:7541— routes.clear_hot_cache 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.
_XmlFunctionBoundary.feed (cyclomatic 19) omlx/api/tool_calling.py:556— _XmlFunctionBoundary.feed 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.
tool_calling._parse_xml_tool_calls (cyclomatic 19) omlx/api/tool_calling.py:938— tool_calling._parse_xml_tool_calls 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.
tool_calling._parse_hermes_tool_calls (cyclomatic 19) omlx/api/tool_calling.py:1174— tool_calling._parse_hermes_tool_calls 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.
catalogue.assess_model (cyclomatic 19) omlx/cluster/catalogue.py:345— catalogue.assess_model 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.
collective.run_local_pipeline_smoke (cyclomatic 19) omlx/cluster/collective.py:188— collective.run_local_pipeline_smoke 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. This shape REPEATS in the file: one other method here (collective._run_local_minimax_decode_smoke) 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.
collective._run_local_minimax_decode_smoke (cyclomatic 19) omlx/cluster/collective.py:279— collective._run_local_minimax_decode_smoke 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. This shape REPEATS in the file: one other method here (collective.run_local_pipeline_smoke) 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.
PeerWatchdog.run (cyclomatic 19) omlx/cluster/liveness.py:511— PeerWatchdog.run has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ModelLayout.__post_init__ (cyclomatic 19) omlx/cluster/planner.py:130— ModelLayout.__post_init__ 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.
planner._tensor_parallel_divisors (cyclomatic 19) omlx/cluster/planner.py:734— planner._tensor_parallel_divisors 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.
DeviceRegistry.mark_paired (cyclomatic 19) omlx/cluster/registry.py:483— DeviceRegistry.mark_paired has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
routes._resolve_fabric (cyclomatic 19) omlx/cluster/routes.py:1059— routes._resolve_fabric 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.
VLMBatchedEngine._encode_missing_vision_features (cyclomatic 19) omlx/engine/vlm.py:3588— VLMBatchedEngine._encode_missing_vision_features 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.
base.chat_models (cyclomatic 19) omlx/integrations/base.py:71— base.chat_models 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.
d3.normalize_question (cyclomatic 19) omlx/models/d3.py:112— d3.normalize_question has cyclomatic complexity 19 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
OpenJevModel.encode (cyclomatic 19) omlx/models/openjev.py:260— OpenJevModel.encode 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.
oq._load_builtin_calibration (cyclomatic 19) omlx/oq.py:8087— oq._load_builtin_calibration 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.
oq._prepare_layer_inputs (cyclomatic 19) omlx/oq.py:8949— oq._prepare_layer_inputs 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.
deepseek_v4_model._batch_indexer_rows (cyclomatic 19) omlx/patches/deepseek_v4/deepseek_v4_model.py:1549— deepseek_v4_model._batch_indexer_rows has cyclomatic complexity 19 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
ane_prefill.enable_ane_prefill (cyclomatic 19) omlx/patches/k2_horizon/ane_prefill.py:277— ane_prefill.enable_ane_prefill 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.
m5_gather_qmm_a8._supports_mx (cyclomatic 19) omlx/patches/m5_gather_qmm_a8.py:1040— m5_gather_qmm_a8._supports_mx 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.
batch_generator._call_backbone_impl (cyclomatic 19) REDACTED:2200— batch_generator._call_backbone_impl 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.
batch_generator._run_verify_cycle_batched (cyclomatic 19) REDACTED:3560— batch_generator._run_verify_cycle_batched 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.
prompt_priming._capture_boundary_candidate (cyclomatic 19) REDACTED:742— prompt_priming._capture_boundary_candidate 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.
decode_kernels.mla_head_qmv (cyclomatic 19) omlx/patches/mlx_vlm_glm5_next_compat/decode_kernels.py:3452— decode_kernels.mla_head_qmv 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.
moe_expert_offload.apply_moe_expert_offload (cyclomatic 19) omlx/patches/moe_expert_offload.py:1045— moe_expert_offload.apply_moe_expert_offload 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.
Scheduler._detect_qwen35_prefill_floor (cyclomatic 19) omlx/scheduler.py:3348— Scheduler._detect_qwen35_prefill_floor 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.
Scheduler._infer_live_layer_cache_types (cyclomatic 19) omlx/scheduler.py:16662— Scheduler._infer_live_layer_cache_types 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.
draft.run_specprefill_draft_scoring (cyclomatic 19) omlx/specprefill/draft.py:92— draft.run_specprefill_draft_scoring 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.
BatchTurboQuantKVCache.merge (cyclomatic 19) omlx/turboquant_kv.py:585— BatchTurboQuantKVCache.merge 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.
cluster_v2.clusterV2Wizard.submitPairApproval (cyclomatic 19) apps/omlx-web/omlx_web/static/js/cluster_v2.js:1431— cluster_v2.clusterV2Wizard.submitPairApproval 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.
custom_theme.defaults (cyclomatic 19) apps/omlx-web/omlx_web/static/js/custom_theme.js:181— custom_theme.defaults 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.
dashboard.dashboard.accBuildText (cyclomatic 19) REDACTED:6410— dashboard.dashboard.accBuildText 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. This is NOT this file's highest cyclomatic complexity: dashboard.dashboard.connectBenchSSE (cyclomatic 20) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
clusterV2Wizard.submitPairApproval (cyclomatic 19) apps/omlx-web/omlx_web/static/js/cluster_v2.js:1431— clusterV2Wizard.submitPairApproval 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.
dashboard.accBuildText (cyclomatic 19) REDACTED:6410— dashboard.accBuildText 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.
dashboard.sortedManagerModels (cyclomatic 19) REDACTED:7311— dashboard.sortedManagerModels has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 1 of the 19 points is its own statement and the rest belongs to one function literal inside it that branches (line 7313). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
Gemma4OutputParserSession._consume_text (cyclomatic 18) omlx/adapter/gemma4.py:373— Gemma4OutputParserSession._consume_text 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.
PagedSSDCacheManager._scan_existing_files (cyclomatic 18) omlx/cache/paged_ssd_cache.py:2446— PagedSSDCacheManager._scan_existing_files 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.
PagedSSDCacheManager.preload_matched_blocks (cyclomatic 18) omlx/cache/paged_ssd_cache.py:4622— PagedSSDCacheManager.preload_matched_blocks 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.
BlockAwarePrefixCache._drop_superseded_arrays_snapshots (cyclomatic 18) omlx/cache/prefix_cache.py:4915— BlockAwarePrefixCache._drop_superseded_arrays_snapshots 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.
autoconfigure.preflight_issues (cyclomatic 18) omlx/cluster/autoconfigure.py:652— autoconfigure.preflight_issues 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.
launch.probe_remote_admission_ceiling (cyclomatic 18) omlx/cluster/launch.py:2087— launch.probe_remote_admission_ceiling 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.
prefill_guard.rank_monitor (cyclomatic 18) omlx/cluster/prefill_guard.py:37— prefill_guard.rank_monitor has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
tensor_strategies.native_shard_is_layer_local (cyclomatic 18) omlx/cluster/tensor_strategies.py:186— tensor_strategies.native_shard_is_layer_local 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.
vlm._gemma4_global_kv_from_per_layer_config (cyclomatic 18) omlx/engine/vlm.py:781— vlm._gemma4_global_kv_from_per_layer_config 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.
ClaudeCodeIntegration.launch (cyclomatic 18) omlx/integrations/claude.py:86— ClaudeCodeIntegration.launch 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.
ModelSettingsManager.update_profile (cyclomatic 18) omlx/model_settings.py:1543— ModelSettingsManager.update_profile 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.
_LazyTensorIndex._classify_pair (cyclomatic 18) omlx/oq.py:5585— _LazyTensorIndex._classify_pair 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.
decode_fast.run_layers (cyclomatic 18) omlx/patches/mimo_v2/decode_fast.py:974— decode_fast.run_layers 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.
batch_generator._run_verify_cycle_legacy (cyclomatic 18) REDACTED:4838— batch_generator._run_verify_cycle_legacy 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.
qwen35_verify_attention.verify_attention (cyclomatic 18) omlx/patches/mlx_vlm_mtp/qwen35_verify_attention.py:178— qwen35_verify_attention.verify_attention 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.
moe_expert_offload._resolve_store_view (cyclomatic 18) omlx/patches/moe_expert_offload.py:979— moe_expert_offload._resolve_store_view 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.
qwen35_verify_sdpa_split._vector_plan (cyclomatic 18) omlx/patches/qwen35_verify_sdpa_split.py:103— qwen35_verify_sdpa_split._vector_plan 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.
Scheduler._drain_pending_async_removes (cyclomatic 18) omlx/scheduler.py:3061— Scheduler._drain_pending_async_removes 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.
AppServices.applyStorageChanges (cyclomatic 18) apps/omlx-mac/Sources/AppView/AppServices.swift:195— AppServices.applyStorageChanges 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.
PrefillAcceleratorGroup.statusText (cyclomatic 18) apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1615— PrefillAcceleratorGroup.statusText has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ModelSettingsScreenVM.load (cyclomatic 18) apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:704— ModelSettingsScreenVM.load 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 is NOT this file's highest cyclomatic complexity: ModelSettingsScreenVM.isDiffusionUnsupportedField (cyclomatic 27) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
ServerScreenVM.restart (cyclomatic 18) apps/omlx-mac/Sources/AppView/ViewModels/ServerScreenVM.swift:644— ServerScreenVM.restart 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.
dashboard.pollANETuning (cyclomatic 18) REDACTED:2859— dashboard.pollANETuning has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
HarmonyStreamingParser.process_token (cyclomatic 17) omlx/adapter/harmony.py:273— HarmonyStreamingParser.process_token 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.
InklingOutputParserSession.finalize (cyclomatic 17) omlx/adapter/output_parser.py:1077— InklingOutputParserSession.finalize 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.
ExternalAPIClient.chat_completion (cyclomatic 17) omlx/admin/external_api.py:292— ExternalAPIClient.chat_completion 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.
hf_uploader._generate_model_card (cyclomatic 17) omlx/admin/hf_uploader.py:226— hf_uploader._generate_model_card 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.
model_recommender.build_sections (cyclomatic 17) omlx/admin/model_recommender.py:368— model_recommender.build_sections 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.
routes._validate_model_settings (cyclomatic 17) omlx/admin/routes.py:3696— routes._validate_model_settings 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.
routes._vlm_mtp_recipe_problem (cyclomatic 17) omlx/admin/routes.py:3960— routes._vlm_mtp_recipe_problem 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.
embedding_utils._item_from_content_parts (cyclomatic 17) omlx/api/embedding_utils.py:195— embedding_utils._item_from_content_parts 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.
ToolCallStreamFilter.__init__ (cyclomatic 17) omlx/api/tool_calling.py:2637— ToolCallStreamFilter.__init__ 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.
ToolCallStreamFilter._could_be_partial_attr_function_open (cyclomatic 17) omlx/api/tool_calling.py:3258— ToolCallStreamFilter._could_be_partial_attr_function_open 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.
tool_calling._merge_json_fragments (cyclomatic 17) omlx/api/tool_calling.py:221— tool_calling._merge_json_fragments 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.
PagedSSDCacheManager.commit_gdn_checkpoint_file (cyclomatic 17) omlx/cache/paged_ssd_cache.py:2606— PagedSSDCacheManager.commit_gdn_checkpoint_file 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.
BlockAwarePrefixCache._block_token_count_matches_slices (cyclomatic 17) omlx/cache/prefix_cache.py:1960— BlockAwarePrefixCache._block_token_count_matches_slices 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.
BlockAwarePrefixCache._strip_rotating_payload (cyclomatic 17) omlx/cache/prefix_cache.py:2197— BlockAwarePrefixCache._strip_rotating_payload 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.
cli.diagnose_menubar (cyclomatic 17) REDACTED:846— cli.diagnose_menubar 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.
RankControlPlane.broadcast_owned_bytes (cyclomatic 17) REDACTED:436— RankControlPlane.broadcast_owned_bytes 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.
inference_worker.main (cyclomatic 17) omlx/cluster/inference_worker.py:1802— inference_worker.main 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.
DistributedJobSupervisor._drain (cyclomatic 17) omlx/cluster/launch.py:2892— DistributedJobSupervisor._drain 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.
launch.run_cluster_performance_probe (cyclomatic 17) omlx/cluster/launch.py:1414— launch.run_cluster_performance_probe 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.
ModelSyncManager.resolve_local_model_path (cyclomatic 17) REDACTED:415— ModelSyncManager.resolve_local_model_path 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.
RuntimeTelemetry._sample_snapshot (cyclomatic 17) omlx/cluster/telemetry.py:888— RuntimeTelemetry._sample_snapshot has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
splash._check_model (cyclomatic 17) REDACTED:593— splash._check_model 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.
VLMBatchedEngine.stream_generate (cyclomatic 17) omlx/engine/vlm.py:4950— VLMBatchedEngine.stream_generate has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
VLMBatchedEngine._diffusion_apply_chat_template (cyclomatic 17) omlx/engine/vlm.py:5694— VLMBatchedEngine._diffusion_apply_chat_template has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
EnginePool.moe_offload_fit (cyclomatic 17) omlx/engine_pool.py:771— EnginePool.moe_offload_fit 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.
Integration.select_model (cyclomatic 17) omlx/integrations/base.py:173— Integration.select_model 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.
claude_desktop.restore (cyclomatic 17) omlx/integrations/claude_desktop.py:226— claude_desktop.restore 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.
_TrackedTensor.__getitem__ (cyclomatic 17) omlx/oq.py:2922— _TrackedTensor.__getitem__ 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.
oq._normalize_sensitivity_map_override (cyclomatic 17) omlx/oq.py:481— oq._normalize_sensitivity_map_override 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.
oq._oqe_calibration_batch_plan (cyclomatic 17) omlx/oq.py:4443— oq._oqe_calibration_batch_plan 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.
oq._prepare_gemma4_layer_inputs (cyclomatic 17) omlx/oq.py:8350— oq._prepare_gemma4_layer_inputs 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.
BatchPoolingCache.extend (cyclomatic 17) omlx/patches/deepseek_v4/cache_extras.py:1017— BatchPoolingCache.extend 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.
chat_template_v4.relocate_mid_system_messages (cyclomatic 17) omlx/patches/deepseek_v4/chat_template_v4.py:776— chat_template_v4.relocate_mid_system_messages has cyclomatic complexity 17 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
m5_gather_qmm.fused_gate_up_activation (cyclomatic 17) omlx/patches/m5_gather_qmm.py:245— m5_gather_qmm.fused_gate_up_activation 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.
MiMoV2Model.__call__ (cyclomatic 17) omlx/patches/mimo_v2/mimo_v2_model.py:425— MiMoV2Model.__call__ has cyclomatic complexity 17 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
pipeline_patch._pipelined_call (cyclomatic 17) omlx/patches/minimax_m3_mlx_lm/pipeline_patch.py:154— pipeline_patch._pipelined_call 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.
mlx_audio_ming3._onnx_float_initializers (cyclomatic 17) omlx/patches/mlx_audio_ming3.py:469— mlx_audio_ming3._onnx_float_initializers 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.
inkling_vlm_runtime._inkling_prime_capture (cyclomatic 17) omlx/patches/mlx_vlm_mtp/inkling_vlm_runtime.py:813— inkling_vlm_runtime._inkling_prime_capture 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.
qwen35_ane_prefill._prepare_gdn_for_bank (cyclomatic 17) omlx/patches/qwen35_ane_prefill.py:1364— qwen35_ane_prefill._prepare_gdn_for_bank 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.
qwen35_oq_a8._classify_uncached (cyclomatic 17) omlx/patches/qwen35_oq_a8.py:166— qwen35_oq_a8._classify_uncached 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.
specprefill.sparse_prefill (cyclomatic 17) omlx/patches/specprefill.py:975— specprefill.sparse_prefill 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.
launcher.resolve_target (cyclomatic 17) omlx/prefill_helper/launcher.py:91— launcher.resolve_target 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.
ProcessMemoryEnforcer._shrink_hot_cache_by (cyclomatic 17) omlx/process_memory_enforcer.py:1282— ProcessMemoryEnforcer._shrink_hot_cache_by 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.
Scheduler._collect_arrays_from_extracted_cache (cyclomatic 17) omlx/scheduler.py:2842— Scheduler._collect_arrays_from_extracted_cache 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.
Scheduler._adaptive_chunk_size (cyclomatic 17) omlx/scheduler.py:5429— Scheduler._adaptive_chunk_size 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.
model_loading._add_glm5_next_nextn_quant_keys (cyclomatic 17) omlx/utils/model_loading.py:128— model_loading._add_glm5_next_nextn_quant_keys has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
nax_attention.nax_mixed_head_dim_attention (cyclomatic 17) omlx/utils/nax_attention.py:970— nax_attention.nax_mixed_head_dim_attention has cyclomatic complexity 17 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
ThroughputBenchScreenVM.pollResults (cyclomatic 17) apps/omlx-mac/Sources/AppView/ViewModels/ThroughputBenchScreenVM.swift:290— ThroughputBenchScreenVM.pollResults 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.
TalkAIPanelView.body (cyclomatic 17) apps/omlx-mac/Sources/AskAI/TalkAIPanel.swift:152— TalkAIPanelView.body has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AppConfig.load (cyclomatic 17) apps/omlx-mac/Sources/Config/AppConfig.swift:287— AppConfig.load 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.
UpdateController.startDownload (cyclomatic 17) apps/omlx-mac/Sources/Updater/UpdateController.swift:385— UpdateController.startDownload 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.
dashboard.dashboard.pollANETuning (cyclomatic 17) REDACTED:2859— dashboard.dashboard.pollANETuning has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: dashboard.dashboard.connectBenchSSE (cyclomatic 20) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
dashboard.dashboard.cacheObsCumulative (cyclomatic 17) REDACTED:5036— dashboard.dashboard.cacheObsCumulative has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: dashboard.dashboard.connectBenchSSE (cyclomatic 20) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
dashboard.applyPresetToForm (cyclomatic 17) REDACTED:2384— dashboard.applyPresetToForm 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.
dashboard.startANETuning (cyclomatic 17) REDACTED:2801— dashboard.startANETuning has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
dashboard.cacheObsCumulative (cyclomatic 17) REDACTED:5036— dashboard.cacheObsCumulative has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
dashboard.connectBenchSSE::onmessage (cyclomatic 17) REDACTED:5441— dashboard.connectBenchSSE::onmessage 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.
MSDownloader._poll_progress (cyclomatic 16) omlx/admin/ms_downloader.py:1066— MSDownloader._poll_progress 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.
ms_downloader._enrich_ms_entry (cyclomatic 16) omlx/admin/ms_downloader.py:262— ms_downloader._enrich_ms_entry has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
routes._apply_model_dirs_runtime (cyclomatic 16) omlx/admin/routes.py:1302— routes._apply_model_dirs_runtime has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
audio_routes._parse_session_update (cyclomatic 16) omlx/api/audio_routes.py:899— audio_routes._parse_session_update has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
decisions.decisions_request (cyclomatic 16) omlx/api/decisions.py:465— decisions.decisions_request has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
markitdown.stream_messages_to_markdown_async (cyclomatic 16) omlx/api/markitdown.py:200— markitdown.stream_messages_to_markdown_async has cyclomatic complexity 16 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
responses_utils.convert_responses_tools (cyclomatic 16) omlx/api/responses_utils.py:434— responses_utils.convert_responses_tools 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.
ToolCallStreamFilter._unwind_withheld_at_eof (cyclomatic 16) omlx/api/tool_calling.py:3462— ToolCallStreamFilter._unwind_withheld_at_eof 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.
PagedSSDCacheManager.close (cyclomatic 16) omlx/cache/paged_ssd_cache.py:5516— PagedSSDCacheManager.close 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.
paged_ssd_cache.cachelist_subtypes_from_cache_list (cyclomatic 16) omlx/cache/paged_ssd_cache.py:656— paged_ssd_cache.cachelist_subtypes_from_cache_list 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.
autoconfigure.order_hosts_for_topology (cyclomatic 16) omlx/cluster/autoconfigure.py:487— autoconfigure.order_hosts_for_topology 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.
inference_worker._think_token_ids (cyclomatic 16) omlx/cluster/inference_worker.py:258— inference_worker._think_token_ids has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
PairingManager.unpair (cyclomatic 16) REDACTED:1612— PairingManager.unpair has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ExecutionSettings.__post_init__ (cyclomatic 16) omlx/cluster/performance.py:182— ExecutionSettings.__post_init__ has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
SSDPromptSnapshotStore._load_manifest_or_reset (cyclomatic 16) omlx/cluster/prompt_snapshot_cache.py:552— SSDPromptSnapshotStore._load_manifest_or_reset 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.
DeviceRegistry._validate_paired (cyclomatic 16) omlx/cluster/registry.py:268— DeviceRegistry._validate_paired has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
DeviceRegistry.merge (cyclomatic 16) omlx/cluster/registry.py:377— DeviceRegistry.merge 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.
routes._reconcile_runtime_ownership (cyclomatic 16) omlx/cluster/routes.py:2022— routes._reconcile_runtime_ownership 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.
telemetry.install_server_telemetry (cyclomatic 16) omlx/cluster/telemetry.py:1113— telemetry.install_server_telemetry has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
BatchedEngine._apply_chat_template (cyclomatic 16) REDACTED:925— BatchedEngine._apply_chat_template 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.
RealtimeVoiceSession.update (cyclomatic 16) omlx/engine/realtime_voice.py:200— RealtimeVoiceSession.update has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
vlm._count_image_tokens_real (cyclomatic 16) omlx/engine/vlm.py:1572— vlm._count_image_tokens_real 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.
EnginePool.register_cluster_model (cyclomatic 16) omlx/engine_pool.py:1782— EnginePool.register_cluster_model has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
copilot.copilot_provider_config (cyclomatic 16) omlx/integrations/copilot.py:50— copilot.copilot_provider_config 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.
MemoryMonitor.set_model_info (cyclomatic 16) REDACTED:485— MemoryMonitor.set_model_info has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
_DeepSeekV4PrefillMemoryProfile.estimate_prefill_transient_bytes (cyclomatic 16) REDACTED:1238— _DeepSeekV4PrefillMemoryProfile.estimate_prefill_transient_bytes 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.
oq._source_imatrix_signature (cyclomatic 16) omlx/oq.py:6093— oq._source_imatrix_signature has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
oq._find_model_layers (cyclomatic 16) omlx/oq.py:8256— oq._find_model_layers 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.
oq._measure_sensitivity_from_model (cyclomatic 16) omlx/oq.py:11203— oq._measure_sensitivity_from_model 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.
deepseek_v32._use_load_fused_wk_weights_proj (cyclomatic 16) omlx/patches/glm_moe_dsa/deepseek_v32.py:28— deepseek_v32._use_load_fused_wk_weights_proj has cyclomatic complexity 16 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
moe_offload.resolve_view (cyclomatic 16) omlx/patches/glm_moe_dsa/moe_offload.py:98— moe_offload.resolve_view 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.
m5_gather_qmm_a8._self_test_extended (cyclomatic 16) omlx/patches/m5_gather_qmm_a8.py:1285— m5_gather_qmm_a8._self_test_extended 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.
batch_generator._record_std_tax_sample (cyclomatic 16) REDACTED:2538— batch_generator._record_std_tax_sample has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
prompt_priming._take_primed (cyclomatic 16) REDACTED:1238— prompt_priming._take_primed 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.
decode_kernels.multi_qmv (cyclomatic 16) omlx/patches/mlx_vlm_glm5_next_compat/decode_kernels.py:3577— decode_kernels.multi_qmv has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
moe_gate_up_fusion.can_fuse (cyclomatic 16) omlx/patches/moe_gate_up_fusion.py:74— moe_gate_up_fusion.can_fuse has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ModelArgs.__post_init__ (cyclomatic 16) omlx/patches/raon1_mini/raon1_mini_model.py:860— ModelArgs.__post_init__ has cyclomatic complexity 16 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
HelperServer._run_chunks (cyclomatic 16) omlx/prefill_helper/worker.py:222— HelperServer._run_chunks 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.
ProcessMemoryEnforcer._propagate_memory_limit (cyclomatic 16) omlx/process_memory_enforcer.py:1460— ProcessMemoryEnforcer._propagate_memory_limit 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.
Scheduler._insert_prefilled_request (cyclomatic 16) omlx/scheduler.py:7534— Scheduler._insert_prefilled_request has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Scheduler._step_vlm_mtp (cyclomatic 16) omlx/scheduler.py:11817— Scheduler._step_vlm_mtp 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.
Scheduler._reschedule_generation_overflow_requests (cyclomatic 16) omlx/scheduler.py:15252— Scheduler._reschedule_generation_overflow_requests 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.
Scheduler._process_pending_memory_requeue (cyclomatic 16) omlx/scheduler.py:15480— Scheduler._process_pending_memory_requeue 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.
Scheduler.shutdown (cyclomatic 16) omlx/scheduler.py:16240— Scheduler.shutdown 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.
server._with_prompt_progress (cyclomatic 16) REDACTED:2968— server._with_prompt_progress 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.
server._build_format_element (cyclomatic 16) REDACTED:5665— server._build_format_element 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.
server._render_chat_prompt_for_thinking_detection (cyclomatic 16) REDACTED:6304— server._render_chat_prompt_for_thinking_detection 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.
ModelCardSheet.metadataRow (cyclomatic 16) apps/omlx-mac/Sources/AppView/Screens/ModelCardSheet.swift:251— ModelCardSheet.metadataRow 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.
TurnView.body (cyclomatic 16) apps/omlx-mac/Sources/AskAI/AskAIPanelView.swift:373— TurnView.body has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
AppUpdater.run (cyclomatic 16) apps/omlx-mac/Sources/Updater/AppUpdater.swift:158— AppUpdater.run has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
cluster_v2.clusterV2Wizard.configuredDeployment (cyclomatic 16) apps/omlx-web/omlx_web/static/js/cluster_v2.js:599— cluster_v2.clusterV2Wizard.configuredDeployment has cyclomatic complexity 16 (threshold 15). Of this number, 12 points are the body's own statements and 4 belong to 4 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
cluster_v2.clusterV2Wizard.deploymentRuntimeState (cyclomatic 16) apps/omlx-web/omlx_web/static/js/cluster_v2.js:909— cluster_v2.clusterV2Wizard.deploymentRuntimeState has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
dashboard.dashboard.applyPresetToForm (cyclomatic 16) REDACTED:2384— dashboard.dashboard.applyPresetToForm has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: dashboard.dashboard.connectBenchSSE (cyclomatic 20) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
dashboard.dashboard.startANETuning (cyclomatic 16) REDACTED:2801— dashboard.dashboard.startANETuning has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: dashboard.dashboard.connectBenchSSE (cyclomatic 20) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
dashboard.dashboard.addToAccQueue (cyclomatic 16) REDACTED:6188— dashboard.dashboard.addToAccQueue has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: dashboard.dashboard.connectBenchSSE (cyclomatic 20) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
clusterV2Wizard.configuredDeployment (cyclomatic 16) apps/omlx-web/omlx_web/static/js/cluster_v2.js:599— clusterV2Wizard.configuredDeployment has cyclomatic complexity 16 (threshold 15). Of this number, 10 points are the body's own statements and 6 belong to 10 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
clusterV2Wizard.deploymentRuntimeState (cyclomatic 16) apps/omlx-web/omlx_web/static/js/cluster_v2.js:909— clusterV2Wizard.deploymentRuntimeState has cyclomatic complexity 16 (threshold 15). Of this number, 12 points are the body's own statements and 4 belong to 4 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
dashboard.createProfile (cyclomatic 16) REDACTED:2447— dashboard.createProfile has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
dashboard.applyProfileToForm (cyclomatic 16) REDACTED:2497— dashboard.applyProfileToForm 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.
dashboard.addToAccQueue (cyclomatic 16) REDACTED:6188— dashboard.addToAccQueue has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
BlockAwarePrefixCache.reconstruct_cache (cognitive 653) omlx/cache/prefix_cache.py:3286— BlockAwarePrefixCache.reconstruct_cache has cognitive complexity 653 (threshold 15). Drivers by points: if/else 145 (416 pts), ternaries 20 (84 pts), loops 26 (80 pts), boolean chains 69, error handling 2 (4 pts) (nesting depth added 391). 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.
routes.update_global_settings (cognitive 469) omlx/admin/routes.py:4872— routes.update_global_settings has cognitive complexity 469 (threshold 15). Drivers by points: if/else 215 (343 pts), ternaries 22 (57 pts), boolean chains 41, loops 7 (17 pts), error handling 6 (11 pts) (nesting depth added 178). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
chat.html.chatApp (cognitive 459) apps/omlx-web/omlx_web/templates/chat.html:2841— chat.html.chatApp has cognitive complexity 459 (threshold 15). Drivers by points: if/else 201 (259 pts), boolean chains 142, ternaries 26 (35 pts), loops 21 (22 pts), error handling 1 (nesting depth added 68). Of this number, 432 points are the body's own statements and 27 belong to 13 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
routes.update_model_settings (cognitive 337) omlx/admin/routes.py:2853— routes.update_model_settings has cognitive complexity 337 (threshold 15). Drivers by points: if/else 140 (207 pts), boolean chains 57, ternaries 26 (54 pts), loops 5 (13 pts), error handling 3 (6 pts) (nesting depth added 106). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BlockAwarePrefixCache.store_cache (cognitive 314) omlx/cache/prefix_cache.py:950— BlockAwarePrefixCache.store_cache has cognitive complexity 314 (threshold 15). Drivers by points: if/else 73 (219 pts), boolean chains 52, error handling 2 (17 pts), loops 5 (15 pts), ternaries 7 (11 pts) (nesting depth added 175). 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.
oq.quantize_oq_streaming (cognitive 267) omlx/oq.py:6883— oq.quantize_oq_streaming has cognitive complexity 267 (threshold 15). Drivers by points: if/else 87 (182 pts), boolean chains 37, loops 11 (21 pts), ternaries 7 (16 pts), error handling 5 (11 pts) (nesting depth added 120). 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.
BlockAwarePrefixCache._extract_block_tensor_slice (cognitive 252) omlx/cache/prefix_cache.py:2471— BlockAwarePrefixCache._extract_block_tensor_slice has cognitive complexity 252 (threshold 15). Drivers by points: if/else 48 (136 pts), ternaries 16 (69 pts), boolean chains 33, loops 4 (13 pts), error handling 1 (nesting depth added 150). 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.
Scheduler._process_batch_responses (cognitive 238) omlx/scheduler.py:14081— Scheduler._process_batch_responses has cognitive complexity 238 (threshold 15). Drivers by points: if/else 59 (182 pts), ternaries 11 (31 pts), boolean chains 20, error handling 1 (4 pts), loops 1 (nesting depth added 146). 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.
server.stream_chat_completion (cognitive 237) REDACTED:6628— server.stream_chat_completion has cognitive complexity 237 (threshold 15). Drivers by points: if/else 61 (154 pts), ternaries 17 (34 pts), boolean chains 27, loops 7 (16 pts), error handling 3 (6 pts) (nesting depth added 122). 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.
VLMBatchedEngine._prepare_vision_inputs (cognitive 234) omlx/engine/vlm.py:4045— VLMBatchedEngine._prepare_vision_inputs has cognitive complexity 234 (threshold 15). Drivers by points: if/else 61 (136 pts), loops 9 (30 pts), ternaries 12 (27 pts), boolean chains 26, error handling 7 (15 pts) (nesting depth added 119). 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.
Scheduler._cleanup_finished (cognitive 234) omlx/scheduler.py:14504— Scheduler._cleanup_finished has cognitive complexity 234 (threshold 15). Drivers by points: if/else 46 (163 pts), ternaries 5 (29 pts), error handling 3 (16 pts), boolean chains 15, loops 5 (11 pts) (nesting depth added 160). 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.
oq._build_quant_plan (cognitive 231) omlx/oq.py:1301— oq._build_quant_plan has cognitive complexity 231 (threshold 15). Drivers by points: if/else 67 (163 pts), loops 20 (37 pts), boolean chains 22, ternaries 4 (9 pts) (nesting depth added 118). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
server.stream_responses_api (cognitive 224) REDACTED:9127— server.stream_responses_api has cognitive complexity 224 (threshold 15). Drivers by points: if/else 55 (111 pts), loops 20 (62 pts), boolean chains 29, ternaries 10 (16 pts), error handling 3 (6 pts) (nesting depth added 107). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Scheduler._schedule_waiting (cognitive 222) omlx/scheduler.py:13222— Scheduler._schedule_waiting has cognitive complexity 222 (threshold 15). Drivers by points: if/else 51 (133 pts), error handling 12 (40 pts), boolean chains 25, ternaries 8 (23 pts), loops 1 (nesting depth added 125). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
model_loading.maybe_apply_pre_load_patches (cognitive 201) omlx/utils/model_loading.py:519— model_loading.maybe_apply_pre_load_patches has cognitive complexity 201 (threshold 15). Drivers by points: if/else 79 (129 pts), boolean chains 46, error handling 7 (14 pts), ternaries 7 (12 pts) (nesting depth added 62). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
server.stream_anthropic_messages (cognitive 188) REDACTED:7351— server.stream_anthropic_messages has cognitive complexity 188 (threshold 15). Drivers by points: if/else 60 (141 pts), boolean chains 21, ternaries 10 (14 pts), error handling 4 (7 pts), loops 3 (5 pts) (nesting depth added 90). 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.
anthropic_utils.convert_anthropic_to_internal (cognitive 173) omlx/api/anthropic_utils.py:189— anthropic_utils.convert_anthropic_to_internal has cognitive complexity 173 (threshold 15). Drivers by points: if/else 29 (131 pts), loops 5 (15 pts), boolean chains 13, error handling 1 (8 pts), ternaries 2 (6 pts) (nesting depth added 123). 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.
tool_calling._parse_tool_calls_impl (cognitive 163) omlx/api/tool_calling.py:2050— tool_calling._parse_tool_calls_impl has cognitive complexity 163 (threshold 15). Drivers by points: if/else 38 (105 pts), loops 5 (21 pts), ternaries 4 (18 pts), error handling 2 (10 pts), boolean chains 9 (nesting depth added 105). 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.
VLMBatchedEngine._format_messages_for_vlm_template (cognitive 163) omlx/engine/vlm.py:3158— VLMBatchedEngine._format_messages_for_vlm_template has cognitive complexity 163 (threshold 15). Drivers by points: if/else 37 (122 pts), boolean chains 21, loops 5 (16 pts), ternaries 1 (4 pts) (nesting depth added 99). 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.
Scheduler._do_external_prefill (cognitive 161) omlx/scheduler.py:4369— Scheduler._do_external_prefill has cognitive complexity 161 (threshold 15). Drivers by points: if/else 55 (110 pts), ternaries 10 (26 pts), boolean chains 20, loops 2 (3 pts), error handling 1 (2 pts) (nesting depth added 73). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
routes._build_active_models_data (cognitive 155) omlx/admin/routes.py:6976— routes._build_active_models_data has cognitive complexity 155 (threshold 15). Drivers by points: if/else 31 (74 pts), ternaries 22 (45 pts), boolean chains 19, error handling 4 (14 pts), loops 2 (3 pts) (nesting depth added 77). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PagedSSDCacheManager.save_block (cognitive 146) omlx/cache/paged_ssd_cache.py:3454— PagedSSDCacheManager.save_block has cognitive complexity 146 (threshold 15). Drivers by points: if/else 34 (67 pts), ternaries 14 (33 pts), boolean chains 25, loops 6 (13 pts), error handling 5 (8 pts) (nesting depth added 62). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dashboard.dashboard (cognitive 138) REDACTED:132— dashboard.dashboard has cognitive complexity 138 (threshold 15). Drivers by points: boolean chains 70, if/else 35 (38 pts), ternaries 21 (27 pts), match/switch 2, loops 1 (nesting depth added 9). Of this number, 98 points are the body's own statements and 40 belong to 11 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ProcessMemoryEnforcer._check_and_enforce (cognitive 137) omlx/process_memory_enforcer.py:1734— ProcessMemoryEnforcer._check_and_enforce has cognitive complexity 137 (threshold 15). Drivers by points: if/else 44 (113 pts), boolean chains 12, loops 3 (9 pts), ternaries 3 (nesting depth added 75). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
routes._build_runtime_cache_observability (cognitive 134) omlx/admin/routes.py:6549— routes._build_runtime_cache_observability has cognitive complexity 134 (threshold 15). Drivers by points: if/else 30 (60 pts), boolean chains 40, error handling 7 (15 pts), ternaries 6 (10 pts), loops 5 (9 pts) (nesting depth added 46). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DistributedBatchedEngine.stream_chat (cognitive 128) omlx/engine/distributed.py:1311— DistributedBatchedEngine.stream_chat has cognitive complexity 128 (threshold 15). Drivers by points: if/else 32 (101 pts), boolean chains 12, loops 4 (8 pts), error handling 4 (6 pts), ternaries 1 (nesting depth added 75). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
qwen35_ane_prefill.enable_qwen35_ane_prefill (cognitive 128) omlx/patches/qwen35_ane_prefill.py:3075— qwen35_ane_prefill.enable_qwen35_ane_prefill has cognitive complexity 128 (threshold 15). Drivers by points: if/else 48 (77 pts), ternaries 9 (20 pts), boolean chains 18, loops 4 (7 pts), error handling 3 (6 pts) (nesting depth added 46). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ane_tuning._calibrate_fused_components_sync (cognitive 118) omlx/admin/ane_tuning.py:1080— ane_tuning._calibrate_fused_components_sync has cognitive complexity 118 (threshold 15). Drivers by points: if/else 31 (65 pts), loops 16 (38 pts), boolean chains 8, ternaries 6 (7 pts) (nesting depth added 57). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
responses_utils.convert_responses_input_to_messages (cognitive 113) omlx/api/responses_utils.py:176— responses_utils.convert_responses_input_to_messages has cognitive complexity 113 (threshold 15). Drivers by points: if/else 26 (66 pts), ternaries 8 (24 pts), boolean chains 14, loops 3 (9 pts) (nesting depth added 62). 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.
tool_calling._gemma4_transcode_to_json (cognitive 113) omlx/api/tool_calling.py:1561— tool_calling._gemma4_transcode_to_json has cognitive complexity 113 (threshold 15). Drivers by points: if/else 29 (79 pts), ternaries 3 (11 pts), boolean chains 10, loops 3 (9 pts), error handling 1 (4 pts) (nesting depth added 67). 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.
moe_offload_compat._inspect (cognitive 109) omlx/patches/moe_offload_compat.py:46— moe_offload_compat._inspect has cognitive complexity 109 (threshold 15). Drivers by points: if/else 24 (54 pts), ternaries 8 (29 pts), boolean chains 16, loops 4 (10 pts) (nesting depth added 57). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dashboard.dashboard.buildModelSettingsPayload (cognitive 109) REDACTED:3490— dashboard.dashboard.buildModelSettingsPayload has cognitive complexity 109 (threshold 15). Drivers by points: ternaries 37 (43 pts), boolean chains 35, if/else 14 (30 pts), loops 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
anthropic_utils.convert_anthropic_to_internal_harmony (cognitive 108) omlx/api/anthropic_utils.py:476— anthropic_utils.convert_anthropic_to_internal_harmony has cognitive complexity 108 (threshold 15). Drivers by points: if/else 21 (67 pts), error handling 3 (19 pts), loops 4 (9 pts), ternaries 2 (8 pts), boolean chains 5 (nesting depth added 73). 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.
dashboard.buildModelSettingsPayload (cognitive 108) REDACTED:3490— dashboard.buildModelSettingsPayload has cognitive complexity 108 (threshold 15). Drivers by points: ternaries 37 (40 pts), boolean chains 36, if/else 14 (30 pts), loops 1, other 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelSettingsScreenVM.save (cognitive 105) apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:866— ModelSettingsScreenVM.save has cognitive complexity 105 (threshold 15). Drivers by points: if/else 24 (41 pts), match/switch 15 (29 pts), ternaries 13 (26 pts), boolean chains 8, error handling 1 (nesting depth added 44). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EnginePool._load_engine (cognitive 104) omlx/engine_pool.py:4092— EnginePool._load_engine has cognitive complexity 104 (threshold 15). Drivers by points: if/else 36 (49 pts), error handling 12 (26 pts), boolean chains 22, ternaries 4 (6 pts), loops 1 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Scheduler._extract_cache_states (cognitive 104) omlx/scheduler.py:10391— Scheduler._extract_cache_states has cognitive complexity 104 (threshold 15). Drivers by points: if/else 23 (59 pts), ternaries 3 (13 pts), boolean chains 12, error handling 4 (11 pts), loops 3 (9 pts) (nesting depth added 59). 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.
oq.universal_quant_predicate (cognitive 103) omlx/oq.py:641— oq.universal_quant_predicate has cognitive complexity 103 (threshold 15). Drivers by points: if/else 53 (75 pts), boolean chains 26, ternaries 1 (2 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
accuracy_benchmark.run_accuracy_benchmark (cognitive 99) omlx/admin/accuracy_benchmark.py:365— accuracy_benchmark.run_accuracy_benchmark has cognitive complexity 99 (threshold 15). Drivers by points: if/else 28 (65 pts), error handling 8 (16 pts), ternaries 3 (9 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 54). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ServerScreenVM.applyServerSettings (cognitive 98) apps/omlx-mac/Sources/AppView/ViewModels/ServerScreenVM.swift:241— ServerScreenVM.applyServerSettings has cognitive complexity 98 (threshold 15). Drivers by points: if/else 36 (58 pts), boolean chains 30, ternaries 3 (7 pts), error handling 2 (3 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
oq._build_streaming_proxy_for_sensitivity (cognitive 96) omlx/oq.py:11553— oq._build_streaming_proxy_for_sensitivity has cognitive complexity 96 (threshold 15). Drivers by points: if/else 23 (65 pts), loops 6 (11 pts), ternaries 3 (10 pts), boolean chains 8, error handling 1 (2 pts) (nesting depth added 55). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
routes.cluster_autoconfigure (cognitive 95) omlx/cluster/routes.py:1205— routes.cluster_autoconfigure has cognitive complexity 95 (threshold 15). Drivers by points: if/else 28 (39 pts), boolean chains 26, error handling 10 (19 pts), loops 3 (6 pts), ternaries 4 (5 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dashboard.formValuesForProfile (cognitive 95) REDACTED:1730— dashboard.formValuesForProfile has cognitive complexity 95 (threshold 15). Drivers by points: if/else 31 (72 pts), boolean chains 15, ternaries 2 (6 pts), loops 2 (nesting depth added 45). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
gemma4.extract_gemma4_messages (cognitive 94) omlx/adapter/gemma4.py:73— gemma4.extract_gemma4_messages has cognitive complexity 94 (threshold 15). Drivers by points: if/else 21 (54 pts), ternaries 4 (19 pts), loops 5 (12 pts), boolean chains 9 (nesting depth added 55). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
dashboard.dashboard.formValuesForProfile (cognitive 94) REDACTED:1730— dashboard.dashboard.formValuesForProfile has cognitive complexity 94 (threshold 15). Drivers by points: if/else 31 (72 pts), boolean chains 14, ternaries 2 (6 pts), loops 2 (nesting depth added 45). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
VLMBatchedEngine.start (cognitive 92) omlx/engine/vlm.py:1982— VLMBatchedEngine.start has cognitive complexity 92 (threshold 15). Drivers by points: if/else 38 (48 pts), error handling 21 (35 pts), boolean chains 8, ternaries 1 (nesting depth added 24). 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.
benchmark.run_benchmark (cognitive 90) omlx/admin/benchmark.py:1921— benchmark.run_benchmark has cognitive complexity 90 (threshold 15). Drivers by points: if/else 19 (28 pts), ternaries 12 (22 pts), error handling 11 (18 pts), boolean chains 15, loops 5 (7 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.
image._extract_media (cognitive 89) omlx/utils/image.py:352— image._extract_media has cognitive complexity 89 (threshold 15). Drivers by points: if/else 17 (59 pts), ternaries 5 (18 pts), loops 5 (9 pts), boolean chains 3 (nesting depth added 59). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
oq._collect_imatrix_streaming (cognitive 88) omlx/oq.py:10472— oq._collect_imatrix_streaming has cognitive complexity 88 (threshold 15). Drivers by points: if/else 26 (55 pts), ternaries 6 (18 pts), boolean chains 9, loops 3 (6 pts) (nesting depth added 44). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
batch_generator._run_verify_cycle_chain (cognitive 87) REDACTED:4317— batch_generator._run_verify_cycle_chain has cognitive complexity 87 (threshold 15). Drivers by points: if/else 35 (54 pts), ternaries 8 (14 pts), boolean chains 12, loops 4 (7 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.
Model.sanitize (cognitive 85) omlx/patches/glm_moe_dsa/deepseek_v32.py:844— Model.sanitize has cognitive complexity 85 (threshold 15). Drivers by points: if/else 20 (56 pts), loops 10 (21 pts), boolean chains 8 (nesting depth added 47). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
EnginePool.get_engine (cognitive 84) omlx/engine_pool.py:2698— EnginePool.get_engine has cognitive complexity 84 (threshold 15). Drivers by points: if/else 29 (58 pts), boolean chains 13, ternaries 5 (11 pts), loops 1 (2 pts) (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
qwen35_ane_prefill._enable_dual_procedure_banks (cognitive 84) omlx/patches/qwen35_ane_prefill.py:2463— qwen35_ane_prefill._enable_dual_procedure_banks has cognitive complexity 84 (threshold 15). Drivers by points: if/else 30 (45 pts), loops 10 (13 pts), error handling 5 (11 pts), ternaries 4 (8 pts), boolean chains 7 (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.
dashboard.buildModelSettingsState (cognitive 84) REDACTED:2155— dashboard.buildModelSettingsState has cognitive complexity 84 (threshold 15). Drivers by points: boolean chains 52, other 26, ternaries 6. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PagedSSDCacheManager._reconstruct_cache_data (cognitive 83) omlx/cache/paged_ssd_cache.py:3978— PagedSSDCacheManager._reconstruct_cache_data has cognitive complexity 83 (threshold 15). Drivers by points: if/else 16 (43 pts), ternaries 5 (13 pts), boolean chains 12, error handling 3 (10 pts), loops 2 (5 pts) (nesting depth added 45). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
server.list_models (cognitive 82) REDACTED:3804— server.list_models has cognitive complexity 82 (threshold 15). Drivers by points: if/else 17 (51 pts), loops 6 (19 pts), boolean chains 12 (nesting depth added 47). 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.
tool_calling.parse_qwen_tool_calls (cognitive 81) omlx/api/tool_calling.py:2347— tool_calling.parse_qwen_tool_calls has cognitive complexity 81 (threshold 15). Drivers by points: if/else 18 (49 pts), boolean chains 13, loops 3 (8 pts), ternaries 3 (7 pts), error handling 1 (4 pts) (nesting depth added 43). 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.
oq._forward_layer_result (cognitive 80) omlx/oq.py:8585— oq._forward_layer_result has cognitive complexity 80 (threshold 15). Drivers by points: if/else 19 (26 pts), ternaries 10 (26 pts), error handling 9 (17 pts), boolean chains 11 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GlobalSettings.validate (cognitive 79) omlx/settings.py:1685— GlobalSettings.validate has cognitive complexity 79 (threshold 15). Drivers by points: if/else 49 (57 pts), boolean chains 12, error handling 6 (7 pts), loops 1 (2 pts), ternaries 1 (nesting depth added 10). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
oq.estimate_bpw_and_size (cognitive 78) omlx/oq.py:3971— oq.estimate_bpw_and_size has cognitive complexity 78 (threshold 15). Drivers by points: if/else 29 (53 pts), boolean chains 10, loops 7 (10 pts), ternaries 2 (4 pts), error handling 1 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Scheduler._prepare_prefix_cache_for_request (cognitive 77) omlx/scheduler.py:11020— Scheduler._prepare_prefix_cache_for_request has cognitive complexity 77 (threshold 15). Drivers by points: if/else 25 (66 pts), boolean chains 6, ternaries 2 (4 pts), error handling 1 (nesting depth added 43). 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.
routes.list_models (cognitive 76) omlx/admin/routes.py:2390— routes.list_models has cognitive complexity 76 (threshold 15). Drivers by points: if/else 17 (44 pts), boolean chains 14, error handling 3 (8 pts), ternaries 4 (6 pts), loops 3 (4 pts) (nesting depth added 35). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
oq._build_model_sanitizer (cognitive 76) omlx/oq.py:4706— oq._build_model_sanitizer has cognitive complexity 76 (threshold 15). Drivers by points: if/else 26 (40 pts), error handling 13 (24 pts), boolean chains 6, ternaries 3 (6 pts) (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
chat_template_v4.render_message (cognitive 76) omlx/patches/deepseek_v4/chat_template_v4.py:291— chat_template_v4.render_message has cognitive complexity 76 (threshold 15). Drivers by points: if/else 28 (53 pts), boolean chains 11, loops 2 (9 pts), ternaries 1 (3 pts) (nesting depth added 34). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
Model.sanitize (cognitive 75) omlx/patches/deepseek_v4/deepseek_v4_model.py:2414— Model.sanitize has cognitive complexity 75 (threshold 15). Drivers by points: if/else 17 (41 pts), loops 14 (23 pts), boolean chains 6, error handling 1 (3 pts), ternaries 1 (2 pts) (nesting depth added 36). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
DFlashDrafter._draft_batched (cognitive 75) omlx/speculative/dflash/drafter.py:591— DFlashDrafter._draft_batched has cognitive complexity 75 (threshold 15). Drivers by points: if/else 32 (54 pts), ternaries 7 (10 pts), loops 6 (9 pts), boolean chains 2 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ane_tuning._calibrate_components_sync (cognitive 74) omlx/admin/ane_tuning.py:1728— ane_tuning._calibrate_components_sync has cognitive complexity 74 (threshold 15). Drivers by points: if/else 24 (37 pts), boolean chains 14, loops 8 (13 pts), ternaries 8 (10 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.launch_command (cognitive 74) REDACTED:465— cli.launch_command has cognitive complexity 74 (threshold 15). Drivers by points: if/else 22 (34 pts), boolean chains 17, ternaries 8 (12 pts), loops 3 (6 pts), error handling 4 (5 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
model_discovery.detect_model_type (cognitive 74) omlx/model_discovery.py:710— model_discovery.detect_model_type has cognitive complexity 74 (threshold 15). Drivers by points: if/else 33 (54 pts), boolean chains 10, loops 9, error handling 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BoundarySnapshotSSDStore._serialize_extracted (cognitive 73) omlx/cache/boundary_snapshot_store.py:1212— BoundarySnapshotSSDStore._serialize_extracted has cognitive complexity 73 (threshold 15). Drivers by points: if/else 17 (56 pts), loops 5 (13 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 48). 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.
SparseCompressedAttention.__call__ (cognitive 73) omlx/patches/deepseek_v4/deepseek_v4_model.py:2004— SparseCompressedAttention.__call__ has cognitive complexity 73 (threshold 15). Drivers by points: if/else 26 (50 pts), ternaries 8 (10 pts), boolean chains 9, error handling 1 (4 pts) (nesting depth added 29). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
launch._sweep_rank_processes (cognitive 71) omlx/cluster/launch.py:651— launch._sweep_rank_processes has cognitive complexity 71 (threshold 15). Drivers by points: if/else 26 (57 pts), boolean chains 6, loops 4 (6 pts), error handling 1, ternaries 1 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelSettingsScreenVM.currentSettingsDict (cognitive 71) apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:1756— ModelSettingsScreenVM.currentSettingsDict has cognitive complexity 71 (threshold 15). Drivers by points: if/else 30 (58 pts), ternaries 4 (9 pts), boolean chains 4 (nesting depth added 33). Of this number, 66 points are the body's own statements and 5 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cluster_v2.clusterV2Wizard.checkRows (cognitive 70) apps/omlx-web/omlx_web/static/js/cluster_v2.js:2073— cluster_v2.clusterV2Wizard.checkRows has cognitive complexity 70 (threshold 15). Drivers by points: ternaries 22 (44 pts), if/else 12 (16 pts), boolean chains 10 (nesting depth added 26). Of this number, 59 points are the body's own statements and 11 belong to 4 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
context_benchmark.run_context_benchmark (cognitive 68) omlx/admin/context_benchmark.py:401— context_benchmark.run_context_benchmark has cognitive complexity 68 (threshold 15). Drivers by points: if/else 21 (35 pts), error handling 8 (13 pts), boolean chains 11, loops 4 (5 pts), ternaries 2 (4 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HFDownloader._run_download (cognitive 68) REDACTED:2003— HFDownloader._run_download has cognitive complexity 68 (threshold 15). Drivers by points: if/else 26 (34 pts), error handling 17 (24 pts), boolean chains 9, ternaries 1 (nesting depth added 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
server._with_sse_keepalive (cognitive 68) REDACTED:3073— server._with_sse_keepalive has cognitive complexity 68 (threshold 15). Drivers by points: if/else 16 (42 pts), ternaries 4 (11 pts), error handling 3 (10 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
server.create_response (cognitive 68) REDACTED:8585— server.create_response has cognitive complexity 68 (threshold 15). Drivers by points: if/else 29 (41 pts), boolean chains 20, ternaries 3, error handling 2, loops 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ToolCallStreamFilter.feed (cognitive 67) omlx/api/tool_calling.py:3557— ToolCallStreamFilter.feed has cognitive complexity 67 (threshold 15). Drivers by points: if/else 26 (62 pts), boolean chains 3, loops 2 (nesting depth added 36). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
oq._measure_sensitivity_from_quantized_model (cognitive 67) omlx/oq.py:11782— oq._measure_sensitivity_from_quantized_model has cognitive complexity 67 (threshold 15). Drivers by points: if/else 22 (42 pts), boolean chains 7, ternaries 3 (7 pts), error handling 3 (6 pts), loops 3 (5 pts) (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DistributedBatchedEngine.stream_generate (cognitive 65) omlx/engine/distributed.py:1661— DistributedBatchedEngine.stream_generate has cognitive complexity 65 (threshold 15). Drivers by points: if/else 17 (50 pts), boolean chains 6, error handling 4 (6 pts), loops 2 (3 pts) (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
oq._collect_imatrix_from_model (cognitive 64) omlx/oq.py:9520— oq._collect_imatrix_from_model has cognitive complexity 64 (threshold 15). Drivers by points: if/else 16 (33 pts), ternaries 5 (16 pts), boolean chains 9, loops 3 (6 pts) (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Indexer.__call__ (cognitive 64) omlx/patches/glm_moe_dsa/deepseek_v32.py:214— Indexer.__call__ has cognitive complexity 64 (threshold 15). Drivers by points: if/else 20 (37 pts), ternaries 5 (12 pts), boolean chains 11, loops 1 (4 pts) (nesting depth added 27). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
Scheduler.step (cognitive 64) omlx/scheduler.py:15736— Scheduler.step has cognitive complexity 64 (threshold 15). Drivers by points: if/else 30 (42 pts), boolean chains 11, loops 2 (6 pts), error handling 4, ternaries 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
routes.clear_ssd_cache (cognitive 62) omlx/admin/routes.py:7414— routes.clear_ssd_cache has cognitive complexity 62 (threshold 15). Drivers by points: if/else 12 (26 pts), error handling 8 (25 pts), loops 4 (11 pts) (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
probe.collect_cluster_status (cognitive 62) omlx/cluster/probe.py:409— probe.collect_cluster_status has cognitive complexity 62 (threshold 15). Drivers by points: if/else 18 (21 pts), ternaries 14 (18 pts), boolean chains 16, error handling 3 (6 pts), loops 1 (nesting depth added 10). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
runtime._validated_marker (cognitive 62) omlx/cluster/runtime.py:418— runtime._validated_marker has cognitive complexity 62 (threshold 15). Drivers by points: if/else 28 (45 pts), boolean chains 11, loops 2 (3 pts), ternaries 1 (2 pts), error handling 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelSettingsScreenVM.enabledFeatures (cognitive 62) apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:1598— ModelSettingsScreenVM.enabledFeatures has cognitive complexity 62 (threshold 15). Drivers by points: if/else 22 (47 pts), boolean chains 14, match/switch 1 (nesting depth added 25). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
BlockAwarePrefixCache._get_cache_seq_len (cognitive 61) omlx/cache/prefix_cache.py:2012— BlockAwarePrefixCache._get_cache_seq_len has cognitive complexity 61 (threshold 15). Drivers by points: if/else 17 (38 pts), boolean chains 10, loops 5 (7 pts), error handling 2 (4 pts), ternaries 1 (2 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.
DistributedJobSupervisor._terminate (cognitive 61) omlx/cluster/launch.py:3073— DistributedJobSupervisor._terminate has cognitive complexity 61 (threshold 15). Drivers by points: if/else 14 (27 pts), error handling 4 (14 pts), ternaries 4 (12 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 34). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
VLMBatchedEngine._compute_vision_features (cognitive 61) omlx/engine/vlm.py:3458— VLMBatchedEngine._compute_vision_features has cognitive complexity 61 (threshold 15). Drivers by points: if/else 19 (45 pts), boolean chains 7, error handling 2 (7 pts), ternaries 1 (2 pts) (nesting depth added 32). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
oq._discover_sanitize_plan (cognitive 60) omlx/oq.py:3176— oq._discover_sanitize_plan has cognitive complexity 60 (threshold 15). Drivers by points: if/else 19 (46 pts), loops 4 (6 pts), boolean chains 4, ternaries 1 (4 pts) (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Model.sanitize (cognitive 60) omlx/patches/raon1_mini/raon1_mini_model.py:1932— Model.sanitize has cognitive complexity 60 (threshold 15). Drivers by points: if/else 15 (40 pts), loops 5 (11 pts), boolean chains 5, ternaries 1 (4 pts) (nesting depth added 34). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
GlobalSettings._apply_cli_overrides (cognitive 60) omlx/settings.py:1390— GlobalSettings._apply_cli_overrides has cognitive complexity 60 (threshold 15). Drivers by points: if/else 32 (34 pts), boolean chains 24, ternaries 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
dashboard.dashboard.accDownloadResult (cognitive 59) REDACTED:6531— dashboard.dashboard.accDownloadResult has cognitive complexity 59 (threshold 15). Drivers by points: if/else 13 (25 pts), boolean chains 21, ternaries 3 (9 pts), loops 2 (4 pts) (nesting depth added 20). Of this number, 56 points are the body's own statements and 3 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dashboard.accDownloadResult (cognitive 59) REDACTED:6531— dashboard.accDownloadResult has cognitive complexity 59 (threshold 15). Drivers by points: if/else 13 (25 pts), boolean chains 21, ternaries 3 (8 pts), loops 2 (4 pts), other 1 (nesting depth added 19). Of this number, 56 points are the body's own statements and 3 belong to 12 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Scheduler._advance_chunked_prefills (cognitive 58) omlx/scheduler.py:7920— Scheduler._advance_chunked_prefills has cognitive complexity 58 (threshold 15). Drivers by points: if/else 16 (30 pts), error handling 6 (14 pts), boolean chains 7, ternaries 1 (4 pts), loops 2 (3 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.
server.get_engine (cognitive 58) REDACTED:1470— server.get_engine has cognitive complexity 58 (threshold 15). Drivers by points: if/else 18 (29 pts), error handling 9 (11 pts), ternaries 4 (10 pts), boolean chains 5, loops 1 (3 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GlobalSettings._apply_env_overrides (cognitive 58) omlx/settings.py:1224— GlobalSettings._apply_env_overrides has cognitive complexity 58 (threshold 15). Drivers by points: if/else 36 (37 pts), error handling 8 (16 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 10). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
routes.list_hf_models (cognitive 57) omlx/admin/routes.py:8202— routes.list_hf_models has cognitive complexity 57 (threshold 15). Drivers by points: if/else 12 (35 pts), boolean chains 10, loops 5 (9 pts), ternaries 2, error handling 1 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
model_discovery._missing_weight_shards (cognitive 57) omlx/model_discovery.py:1270— model_discovery._missing_weight_shards has cognitive complexity 57 (threshold 15). Drivers by points: if/else 18 (42 pts), boolean chains 4, loops 3 (4 pts), ternaries 2 (4 pts), error handling 2 (3 pts) (nesting depth added 28). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
dashboard.dashboard.buildModelSettingsState (cognitive 57) REDACTED:2155— dashboard.dashboard.buildModelSettingsState has cognitive complexity 57 (threshold 15). Drivers by points: boolean chains 51, ternaries 6. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
planner.inspect_safetensors_layout (cognitive 56) omlx/cluster/planner.py:1251— planner.inspect_safetensors_layout has cognitive complexity 56 (threshold 15). Drivers by points: if/else 18 (41 pts), boolean chains 8, loops 3 (5 pts), ternaries 2 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
planner._partition_layers (cognitive 56) omlx/cluster/planner.py:1547— planner._partition_layers has cognitive complexity 56 (threshold 15). Drivers by points: if/else 12 (32 pts), ternaries 6 (14 pts), loops 4 (7 pts), boolean chains 3 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
server.lifespan (cognitive 55) REDACTED:509— server.lifespan has cognitive complexity 55 (threshold 15). Drivers by points: if/else 24 (26 pts), error handling 9 (17 pts), boolean chains 8, ternaries 2 (4 pts) (nesting depth added 12). 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.
ane_tuning.run_tuning (cognitive 54) omlx/admin/ane_tuning.py:2102— ane_tuning.run_tuning has cognitive complexity 54 (threshold 15). Drivers by points: if/else 16 (21 pts), boolean chains 15, ternaries 5 (9 pts), error handling 5 (6 pts), loops 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
deepseek_v41_delta.restore_chain (cognitive 54) omlx/cache/deepseek_v41_delta.py:87— deepseek_v41_delta.restore_chain has cognitive complexity 54 (threshold 15). Drivers by points: if/else 12 (28 pts), boolean chains 14, loops 4 (7 pts), ternaries 2 (5 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.serve_command (cognitive 54) REDACTED:173— cli.serve_command has cognitive complexity 54 (threshold 15). Drivers by points: if/else 32 (37 pts), loops 8 (9 pts), error handling 4 (5 pts), ternaries 2, 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.
BatchedEngine.start (cognitive 54) REDACTED:289— BatchedEngine.start has cognitive complexity 54 (threshold 15). Drivers by points: if/else 23 (28 pts), error handling 10 (20 pts), boolean chains 5, ternaries 1 (nesting depth added 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Scheduler.__init__ (cognitive 54) omlx/scheduler.py:2198— Scheduler.__init__ has cognitive complexity 54 (threshold 15). Drivers by points: if/else 22 (32 pts), error handling 5 (10 pts), boolean chains 9, ternaries 3 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
server.get_sampling_params (cognitive 54) REDACTED:1896— server.get_sampling_params has cognitive complexity 54 (threshold 15). Drivers by points: if/else 25 (31 pts), boolean chains 19, ternaries 4 (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.
Scheduler._do_abort_request (cognitive 53) omlx/scheduler.py:12294— Scheduler._do_abort_request has cognitive complexity 53 (threshold 15). Drivers by points: if/else 26 (42 pts), boolean chains 9, error handling 1 (2 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
model_loading.expand_per_layer_quant_keys (cognitive 53) omlx/utils/model_loading.py:185— model_loading.expand_per_layer_quant_keys has cognitive complexity 53 (threshold 15). Drivers by points: if/else 13 (39 pts), loops 4 (9 pts), boolean chains 5 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
benchmark._run_single_test (cognitive 52) omlx/admin/benchmark.py:842— benchmark._run_single_test has cognitive complexity 52 (threshold 15). Drivers by points: if/else 21 (31 pts), boolean chains 13, ternaries 2 (4 pts), error handling 3, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
audio_routes._split_tts_text (cognitive 52) omlx/api/audio_routes.py:284— audio_routes._split_tts_text has cognitive complexity 52 (threshold 15). Drivers by points: if/else 13 (33 pts), loops 3 (8 pts), ternaries 2 (6 pts), boolean chains 5 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
autoconfigure.choose_parallelism (cognitive 52) omlx/cluster/autoconfigure.py:142— autoconfigure.choose_parallelism has cognitive complexity 52 (threshold 15). Drivers by points: if/else 21 (34 pts), boolean chains 9, ternaries 2 (6 pts), error handling 1 (2 pts), loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
VLMBatchedEngine._iter_diffusion_outputs_sync (cognitive 52) omlx/engine/vlm.py:5831— VLMBatchedEngine._iter_diffusion_outputs_sync has cognitive complexity 52 (threshold 15). Drivers by points: if/else 15 (26 pts), boolean chains 19, error handling 3 (4 pts), loops 2, ternaries 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.
server.init_server (cognitive 52) REDACTED:2485— server.init_server has cognitive complexity 52 (threshold 15). Drivers by points: if/else 27 (33 pts), ternaries 7 (8 pts), error handling 4 (6 pts), boolean chains 4, loops 1 (nesting depth added 9). 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.
launch.stop_deployment_processes (cognitive 51) omlx/cluster/launch.py:827— launch.stop_deployment_processes has cognitive complexity 51 (threshold 15). Drivers by points: if/else 15 (44 pts), boolean chains 4, error handling 1 (2 pts), ternaries 1 (nesting depth added 30). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
planner.plan_hybrid (cognitive 51) omlx/cluster/planner.py:2267— planner.plan_hybrid has cognitive complexity 51 (threshold 15). Drivers by points: if/else 16 (23 pts), ternaries 9 (22 pts), loops 3 (4 pts), boolean chains 1, error handling 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Scheduler._set_model_info_for_monitor (cognitive 51) omlx/scheduler.py:16381— Scheduler._set_model_info_for_monitor has cognitive complexity 51 (threshold 15). Drivers by points: if/else 16 (19 pts), boolean chains 16, ternaries 6 (10 pts), error handling 3 (5 pts), loops 1 (nesting depth added 9). 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.
clusterV2Wizard.checkRows (cognitive 51) apps/omlx-web/omlx_web/static/js/cluster_v2.js:2073— clusterV2Wizard.checkRows has cognitive complexity 51 (threshold 15). Drivers by points: ternaries 22 (25 pts), if/else 12 (16 pts), boolean chains 10 (nesting depth added 7). Of this number, 40 points are the body's own statements and 11 belong to 14 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
routes.delete_hf_model (cognitive 50) omlx/admin/routes.py:8344— routes.delete_hf_model has cognitive complexity 50 (threshold 15). Drivers by points: if/else 18 (31 pts), boolean chains 8, error handling 4 (7 pts), loops 2 (3 pts), ternaries 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tool_calling._coerce_param_value (cognitive 50) omlx/api/tool_calling.py:342— tool_calling._coerce_param_value has cognitive complexity 50 (threshold 15). Drivers by points: if/else 16 (27 pts), error handling 6 (11 pts), ternaries 4 (8 pts), boolean chains 4 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
paged_ssd_cache._block_cachelist_subtypes (cognitive 50) omlx/cache/paged_ssd_cache.py:585— paged_ssd_cache._block_cachelist_subtypes has cognitive complexity 50 (threshold 15). Drivers by points: if/else 12 (30 pts), boolean chains 10, ternaries 2 (7 pts), loops 2 (3 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BlockAwarePrefixCache._maybe_backfill_dedup_block_payload (cognitive 50) omlx/cache/prefix_cache.py:2333— BlockAwarePrefixCache._maybe_backfill_dedup_block_payload has cognitive complexity 50 (threshold 15). Drivers by points: if/else 15 (30 pts), boolean chains 12, ternaries 2 (4 pts), loops 3, error handling 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
transport.detect_transports (cognitive 50) omlx/cluster/transport.py:236— transport.detect_transports has cognitive complexity 50 (threshold 15). Drivers by points: if/else 9 (28 pts), loops 7 (17 pts), boolean chains 3, error handling 2 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
server.create_chat_completion (cognitive 50) REDACTED:5034— server.create_chat_completion has cognitive complexity 50 (threshold 15). Drivers by points: if/else 27 (32 pts), boolean chains 10, ternaries 2 (4 pts), error handling 2, loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
MenubarIconRecovery.fixStatusKitPermission (cognitive 50) apps/omlx-mac/Sources/Menubar/MenubarVisibilityWatcher.swift:368— MenubarIconRecovery.fixStatusKitPermission has cognitive complexity 50 (threshold 15). Drivers by points: if/else 23 (37 pts), boolean chains 5, error handling 3 (4 pts), ternaries 2 (3 pts), loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClusterDeployment.__post_init__ (cognitive 49) omlx/cluster/deployment.py:369— ClusterDeployment.__post_init__ has cognitive complexity 49 (threshold 15). Drivers by points: if/else 24 (39 pts), boolean chains 5, loops 3 (5 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
decode_kernels.moe_gate_up_swiglu (cognitive 49) omlx/patches/mlx_vlm_glm5_next_compat/decode_kernels.py:798— decode_kernels.moe_gate_up_swiglu has cognitive complexity 49 (threshold 15). Drivers by points: if/else 23 (33 pts), boolean chains 13, ternaries 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Scheduler._plan_prefill_rows (cognitive 49) omlx/scheduler.py:7737— Scheduler._plan_prefill_rows has cognitive complexity 49 (threshold 15). Drivers by points: if/else 13 (23 pts), boolean chains 10, ternaries 4 (9 pts), loops 4 (5 pts), error handling 1 (2 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tool_calling._parse_hermes_tool_calls (cognitive 48) omlx/api/tool_calling.py:1174— tool_calling._parse_hermes_tool_calls has cognitive complexity 48 (threshold 15). Drivers by points: if/else 9 (23 pts), error handling 5 (17 pts), loops 3 (6 pts), ternaries 1 (2 pts) (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BoundarySnapshotSSDStore._read_state_tuple_raw (cognitive 48) omlx/cache/boundary_snapshot_store.py:1786— BoundarySnapshotSSDStore._read_state_tuple_raw has cognitive complexity 48 (threshold 15). Drivers by points: if/else 16 (33 pts), error handling 3 (7 pts), loops 3 (7 pts), ternaries 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.
routes._activate_and_report (cognitive 48) omlx/cluster/routes.py:3479— routes._activate_and_report has cognitive complexity 48 (threshold 15). Drivers by points: if/else 13 (21 pts), error handling 10 (14 pts), ternaries 5 (10 pts), boolean chains 3 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
runtime._validated_metrics (cognitive 48) omlx/cluster/runtime.py:196— runtime._validated_metrics has cognitive complexity 48 (threshold 15). Drivers by points: if/else 19 (32 pts), loops 5 (9 pts), boolean chains 6, ternaries 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
prompt_priming._capture_single (cognitive 48) REDACTED:1100— prompt_priming._capture_single has cognitive complexity 48 (threshold 15). Drivers by points: if/else 19 (26 pts), ternaries 8 (16 pts), boolean chains 4, loops 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ThinkingParser.feed (cognitive 47) omlx/api/thinking.py:321— ThinkingParser.feed has cognitive complexity 47 (threshold 15). Drivers by points: if/else 18 (42 pts), boolean chains 4, loops 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tool_calling._parse_xml_tool_calls (cognitive 47) omlx/api/tool_calling.py:938— tool_calling._parse_xml_tool_calls has cognitive complexity 47 (threshold 15). Drivers by points: if/else 11 (26 pts), loops 4 (11 pts), ternaries 2 (7 pts), error handling 1 (2 pts), boolean chains 1 (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.
cli.cluster_command (cognitive 47) REDACTED:947— cli.cluster_command has cognitive complexity 47 (threshold 15). Drivers by points: if/else 20 (31 pts), error handling 5 (10 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Indexer.__call__ (cognitive 47) omlx/patches/deepseek_v4/deepseek_v4_model.py:1364— Indexer.__call__ has cognitive complexity 47 (threshold 15). Drivers by points: if/else 17 (29 pts), ternaries 5 (11 pts), boolean chains 5, error handling 1 (2 pts) (nesting depth added 19). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
Scheduler._buffer_stop_sequence_output (cognitive 47) omlx/scheduler.py:8169— Scheduler._buffer_stop_sequence_output has cognitive complexity 47 (threshold 15). Drivers by points: if/else 17 (30 pts), loops 7 (11 pts), boolean chains 6 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
audio_routes._run_realtime_voice (cognitive 46) omlx/api/audio_routes.py:1139— audio_routes._run_realtime_voice has cognitive complexity 46 (threshold 15). Drivers by points: if/else 9 (22 pts), error handling 4 (8 pts), ternaries 2 (6 pts), boolean chains 5, loops 2 (5 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Scheduler._validate_cache (cognitive 46) omlx/scheduler.py:10191— Scheduler._validate_cache has cognitive complexity 46 (threshold 15). Drivers by points: if/else 13 (33 pts), loops 3 (7 pts), boolean chains 4, error handling 1 (2 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ExperimentalSection.body (cognitive 46) apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2494— ExperimentalSection.body has cognitive complexity 46 (threshold 15). Drivers by points: if/else 19 (36 pts), boolean chains 5, ternaries 2 (5 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
routes._feature_problem (cognitive 45) omlx/admin/routes.py:4001— routes._feature_problem has cognitive complexity 45 (threshold 15). Drivers by points: if/else 17 (28 pts), boolean chains 7, error handling 2 (4 pts), ternaries 2 (4 pts), loops 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
paged_ssd_cache._load_nstate_flat (cognitive 45) omlx/cache/paged_ssd_cache.py:823— paged_ssd_cache._load_nstate_flat has cognitive complexity 45 (threshold 15). Drivers by points: if/else 17 (34 pts), boolean chains 7, error handling 1 (2 pts), loops 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.
PairingManager.complete_join (cognitive 45) REDACTED:1072— PairingManager.complete_join has cognitive complexity 45 (threshold 15). Drivers by points: if/else 18 (26 pts), error handling 6 (10 pts), boolean chains 7, ternaries 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
progressive_loading.progressive_sharded_load (cognitive 45) omlx/cluster/progressive_loading.py:74— progressive_loading.progressive_sharded_load has cognitive complexity 45 (threshold 15). Drivers by points: if/else 24 (36 pts), boolean chains 7, loops 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
VLMModelAdapter.__call__ (cognitive 45) omlx/models/vlm.py:613— VLMModelAdapter.__call__ has cognitive complexity 45 (threshold 15). Drivers by points: if/else 17 (32 pts), boolean chains 9, loops 2 (4 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BatchPoolingCache.accumulate_windows (cognitive 45) omlx/patches/deepseek_v4/cache_extras.py:515— BatchPoolingCache.accumulate_windows has cognitive complexity 45 (threshold 15). Drivers by points: if/else 14 (27 pts), ternaries 3 (9 pts), loops 3 (4 pts), boolean chains 3, error handling 1 (2 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Model.sanitize (cognitive 45) omlx/patches/mimo_v2/mimo_v2_model.py:598— Model.sanitize has cognitive complexity 45 (threshold 15). Drivers by points: if/else 13 (26 pts), loops 7 (12 pts), boolean chains 7 (nesting depth added 18). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
decode_kernels.kda_decode_step (cognitive 45) omlx/patches/mlx_vlm_glm5_next_compat/decode_kernels.py:2373— decode_kernels.kda_decode_step has cognitive complexity 45 (threshold 15). Drivers by points: if/else 20 (27 pts), boolean chains 18 (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.
ToolCallStreamFilter._advance_json_scan (cognitive 44) omlx/api/tool_calling.py:2897— ToolCallStreamFilter._advance_json_scan has cognitive complexity 44 (threshold 15). Drivers by points: if/else 16 (33 pts), loops 3 (6 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 21). 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.
BoundarySnapshotSSDStore._read_state_tuple_arrays (cognitive 44) omlx/cache/boundary_snapshot_store.py:1948— BoundarySnapshotSSDStore._read_state_tuple_arrays has cognitive complexity 44 (threshold 15). Drivers by points: if/else 12 (27 pts), error handling 3 (7 pts), loops 3 (7 pts), boolean chains 2, ternaries 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
transport.assess_link (cognitive 44) omlx/cluster/transport.py:890— transport.assess_link has cognitive complexity 44 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 12, ternaries 6 (12 pts), error handling 2 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
moe_expert_offload.estimate_offload_admission_bytes (cognitive 44) omlx/patches/moe_expert_offload.py:1172— moe_expert_offload.estimate_offload_admission_bytes has cognitive complexity 44 (threshold 15). Drivers by points: if/else 15 (34 pts), loops 4 (5 pts), boolean chains 4, error handling 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Scheduler._collect_arrays_from_extracted_cache (cognitive 44) omlx/scheduler.py:2842— Scheduler._collect_arrays_from_extracted_cache has cognitive complexity 44 (threshold 15). Drivers by points: if/else 7 (26 pts), loops 5 (17 pts), boolean chains 1 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Scheduler._run_prefill_chunks (cognitive 44) omlx/scheduler.py:7200— Scheduler._run_prefill_chunks has cognitive complexity 44 (threshold 15). Drivers by points: if/else 14 (23 pts), ternaries 4 (9 pts), boolean chains 5, loops 5, error handling 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BoundarySnapshotSSDStore._process_write_item (cognitive 43) omlx/cache/boundary_snapshot_store.py:1072— BoundarySnapshotSSDStore._process_write_item has cognitive complexity 43 (threshold 15). Drivers by points: if/else 15 (23 pts), error handling 6 (12 pts), boolean chains 6, loops 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BlockAwarePrefixCache._validate_block_cache_data (cognitive 43) omlx/cache/prefix_cache.py:5242— BlockAwarePrefixCache._validate_block_cache_data has cognitive complexity 43 (threshold 15). Drivers by points: if/else 14 (30 pts), boolean chains 7, ternaries 1 (3 pts), error handling 1 (2 pts), loops 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
launch.preflight_remote_hosts (cognitive 43) omlx/cluster/launch.py:2392— launch.preflight_remote_hosts has cognitive complexity 43 (threshold 15). Drivers by points: if/else 13 (25 pts), boolean chains 6, ternaries 3 (6 pts), error handling 3 (5 pts), loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EnginePool.resolve_model_id (cognitive 43) omlx/engine_pool.py:1981— EnginePool.resolve_model_id has cognitive complexity 43 (threshold 15). Drivers by points: if/else 17 (33 pts), loops 2 (5 pts), error handling 1 (3 pts), boolean chains 2 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
qwen38_modelopt_mixed.transform_weights_exact (cognitive 43) omlx/patches/qwen38_modelopt_mixed.py:283— qwen38_modelopt_mixed.transform_weights_exact has cognitive complexity 43 (threshold 15). Drivers by points: if/else 15 (39 pts), boolean chains 3, loops 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ane_tuning._measure_candidate (cognitive 42) omlx/admin/ane_tuning.py:591— ane_tuning._measure_candidate has cognitive complexity 42 (threshold 15). Drivers by points: if/else 16 (22 pts), boolean chains 11, ternaries 3 (5 pts), error handling 1 (2 pts), loops 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
planner._tensor_parallel_divisors (cognitive 42) omlx/cluster/planner.py:734— planner._tensor_parallel_divisors has cognitive complexity 42 (threshold 15). Drivers by points: if/else 11 (24 pts), loops 3 (12 pts), ternaries 2 (4 pts), boolean chains 2 (nesting depth added 24). 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.
ModelSettingsManager._load_profiles (cognitive 42) omlx/model_settings.py:1131— ModelSettingsManager._load_profiles has cognitive complexity 42 (threshold 15). Drivers by points: if/else 12 (28 pts), boolean chains 6, error handling 2 (5 pts), loops 2 (3 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
server._prepare_anthropic_prompt (cognitive 42) REDACTED:7828— server._prepare_anthropic_prompt has cognitive complexity 42 (threshold 15). Drivers by points: if/else 16 (24 pts), boolean chains 10, loops 1 (3 pts), ternaries 3, error handling 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dashboard.saveGlobalSettings (cognitive 42) REDACTED:1402— dashboard.saveGlobalSettings has cognitive complexity 42 (threshold 15). Drivers by points: if/else 21 (25 pts), boolean chains 9, ternaries 4 (6 pts), error handling 1, other 1 (nesting depth added 6). Of this number, 38 points are the body's own statements and 4 belong to 4 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
OQManager.start_quantization (cognitive 41) omlx/admin/oq_manager.py:304— OQManager.start_quantization has cognitive complexity 41 (threshold 15). Drivers by points: if/else 20 (29 pts), boolean chains 7, ternaries 2 (4 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
routes.replan_cluster_deployment (cognitive 41) omlx/cluster/routes.py:3842— routes.replan_cluster_deployment has cognitive complexity 41 (threshold 15). Drivers by points: if/else 14 (18 pts), ternaries 10 (11 pts), boolean chains 7, error handling 4 (5 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.
LFM3VoiceBackend._slot (cognitive 41) omlx/engine/lfm3_realtime.py:311— LFM3VoiceBackend._slot has cognitive complexity 41 (threshold 15). Drivers by points: if/else 14 (24 pts), ternaries 5 (13 pts), boolean chains 4 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
model_discovery.discover_models (cognitive 41) omlx/model_discovery.py:1994— model_discovery.discover_models has cognitive complexity 41 (threshold 15). Drivers by points: if/else 13 (32 pts), boolean chains 5, loops 2 (4 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SwitchGLU.__call__ (cognitive 41) omlx/patches/deepseek_v4/switch_layers.py:482— SwitchGLU.__call__ has cognitive complexity 41 (threshold 15). Drivers by points: if/else 18 (26 pts), boolean chains 9, ternaries 3 (6 pts) (nesting depth added 11). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
moe_offload.resolve_view (cognitive 41) omlx/patches/glm_moe_dsa/moe_offload.py:98— moe_offload.resolve_view has cognitive complexity 41 (threshold 15). Drivers by points: if/else 8 (27 pts), loops 5 (11 pts), ternaries 2, boolean chains 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.
Scheduler._get_boundary_store_override (cognitive 41) omlx/scheduler.py:9581— Scheduler._get_boundary_store_override has cognitive complexity 41 (threshold 15). Drivers by points: if/else 17 (25 pts), boolean chains 9, ternaries 6, 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.
UpdateController.runCheck (cognitive 41) apps/omlx-mac/Sources/Updater/UpdateController.swift:312— UpdateController.runCheck has cognitive complexity 41 (threshold 15). Drivers by points: if/else 16 (34 pts), boolean chains 5, error handling 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dashboard.validateQwenAneSettings (cognitive 41) REDACTED:3413— dashboard.validateQwenAneSettings has cognitive complexity 41 (threshold 15). Drivers by points: if/else 24 (33 pts), boolean chains 8 (nesting depth added 9). Of this number, 30 points are the body's own statements and 11 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ane_tuning._profile_refinement (cognitive 40) omlx/admin/ane_tuning.py:802— ane_tuning._profile_refinement has cognitive complexity 40 (threshold 15). Drivers by points: if/else 8 (16 pts), ternaries 7 (15 pts), boolean chains 9 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
routes._delete_gguf_model (cognitive 40) omlx/admin/routes.py:8502— routes._delete_gguf_model has cognitive complexity 40 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 8, loops 3 (7 pts), error handling 2 (3 pts), ternaries 2 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
stage_transport.install_stage_links (cognitive 40) omlx/cluster/rdma/stage_transport.py:218— stage_transport.install_stage_links has cognitive complexity 40 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 9, error handling 3 (7 pts), ternaries 3 (5 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelSettingsManager._repair_profile_references (cognitive 40) omlx/model_settings.py:732— ModelSettingsManager._repair_profile_references has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (22 pts), loops 8 (10 pts), boolean chains 4, error handling 3 (4 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.
deepseek_v4_model._sparse_pooled_attention (cognitive 40) omlx/patches/deepseek_v4/deepseek_v4_model.py:789— deepseek_v4_model._sparse_pooled_attention has cognitive complexity 40 (threshold 15). Drivers by points: if/else 17 (24 pts), ternaries 4 (7 pts), boolean chains 6, error handling 1 (3 pts) (nesting depth added 12). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
_DepthController.observe (cognitive 40) REDACTED:2768— _DepthController.observe has cognitive complexity 40 (threshold 15). Drivers by points: if/else 18 (31 pts), ternaries 2 (5 pts), boolean chains 2, loops 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
prompt_priming.maybe_capture (cognitive 40) REDACTED:877— prompt_priming.maybe_capture has cognitive complexity 40 (threshold 15). Drivers by points: if/else 16 (31 pts), boolean chains 4, ternaries 2 (3 pts), loops 1 (2 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PrefillHelperManager._run (cognitive 40) omlx/prefill_helper/manager.py:519— PrefillHelperManager._run has cognitive complexity 40 (threshold 15). Drivers by points: if/else 11 (26 pts), error handling 3 (6 pts), ternaries 1 (4 pts), boolean chains 3, loops 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PerformanceScreenVM.save (cognitive 40) apps/omlx-mac/Sources/AppView/ViewModels/PerformanceScreenVM.swift:223— PerformanceScreenVM.save has cognitive complexity 40 (threshold 15). Drivers by points: if/else 26 (30 pts), boolean chains 6, match/switch 2 (3 pts), error handling 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
defaults (cognitive 40) apps/omlx-web/omlx_web/static/js/custom_theme.js:181— defaults has cognitive complexity 40 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 6 (13 pts), boolean chains 3, ternaries 1 (3 pts), error handling 1 (2 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
benchmark._upload_to_omlx_ai (cognitive 39) omlx/admin/benchmark.py:1640— benchmark._upload_to_omlx_ai has cognitive complexity 39 (threshold 15). Drivers by points: if/else 16 (22 pts), boolean chains 8, ternaries 2 (4 pts), loops 2 (3 pts), error handling 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MSDownloader._run_download (cognitive 39) omlx/admin/ms_downloader.py:902— MSDownloader._run_download has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (20 pts), error handling 7 (12 pts), boolean chains 5, loops 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
pooling_delta.compact_pooling_cache_snapshot (cognitive 39) omlx/cache/pooling_delta.py:22— pooling_delta.compact_pooling_cache_snapshot has cognitive complexity 39 (threshold 15). Drivers by points: if/else 10 (24 pts), boolean chains 7, error handling 1 (3 pts), loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
discovery_routes._enrich_paired_row (cognitive 39) omlx/cluster/discovery_routes.py:213— discovery_routes._enrich_paired_row has cognitive complexity 39 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 13, loops 3 (4 pts), ternaries 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.
MLXRerankerModel._rerank_jina (cognitive 39) omlx/models/reranker.py:1149— MLXRerankerModel._rerank_jina has cognitive complexity 39 (threshold 15). Drivers by points: if/else 16 (25 pts), loops 4 (8 pts), ternaries 2 (5 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
glm5_next_batch_rollback.rollback_rows (cognitive 39) omlx/patches/mlx_vlm_mtp/glm5_next_batch_rollback.py:10— glm5_next_batch_rollback.rollback_rows has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 6, loops 4, ternaries 2 (4 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.
Scheduler._detect_needs_think_prefix (cognitive 39) omlx/scheduler.py:8836— Scheduler._detect_needs_think_prefix has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (24 pts), boolean chains 7, loops 3 (6 pts), error handling 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dashboard.dashboard.validateQwenAneSettings (cognitive 39) REDACTED:3413— dashboard.dashboard.validateQwenAneSettings has cognitive complexity 39 (threshold 15). Drivers by points: if/else 24 (33 pts), boolean chains 6 (nesting depth added 9). Of this number, 30 points are the body's own statements and 9 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HFDownloader.search_models (cognitive 38) REDACTED:1463— HFDownloader.search_models has cognitive complexity 38 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 14, ternaries 2 (4 pts), loops 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HFDownloader._poll_progress (cognitive 38) REDACTED:2376— HFDownloader._poll_progress has cognitive complexity 38 (threshold 15). Drivers by points: if/else 12 (25 pts), ternaries 3 (8 pts), boolean chains 3, error handling 1, loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeerWatchdog.run (cognitive 38) omlx/cluster/liveness.py:511— PeerWatchdog.run has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (22 pts), loops 3 (7 pts), boolean chains 3, error handling 1 (3 pts), ternaries 1 (3 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EnginePool._engine_runtime_signature (cognitive 38) omlx/engine_pool.py:1250— EnginePool._engine_runtime_signature has cognitive complexity 38 (threshold 15). Drivers by points: if/else 20 (26 pts), boolean chains 10, ternaries 2 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
EnginePool._evict_idle_lru_for_prefill (cognitive 38) omlx/engine_pool.py:3238— EnginePool._evict_idle_lru_for_prefill has cognitive complexity 38 (threshold 15). Drivers by points: if/else 12 (29 pts), boolean chains 7, loops 2 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MLXRerankerModel._resolve_token_id (cognitive 38) omlx/models/reranker.py:549— MLXRerankerModel._resolve_token_id has cognitive complexity 38 (threshold 15). Drivers by points: if/else 12 (21 pts), error handling 5 (10 pts), boolean chains 6, loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
fused_batch._advance_group (cognitive 38) omlx/patches/mlx_lm_mtp/fused_batch.py:126— fused_batch._advance_group has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 10, ternaries 4 (7 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
server.stream_completion (cognitive 38) REDACTED:6085— server.stream_completion has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (18 pts), ternaries 5 (11 pts), boolean chains 7, error handling 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
accuracy_upload.trim_question_results (cognitive 37) omlx/admin/accuracy_upload.py:147— accuracy_upload.trim_question_results has cognitive complexity 37 (threshold 15). Drivers by points: if/else 11 (25 pts), boolean chains 6, loops 3 (4 pts), ternaries 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
routes.probe_cache (cognitive 37) omlx/admin/routes.py:7731— routes.probe_cache has cognitive complexity 37 (threshold 15). Drivers by points: if/else 16 (20 pts), ternaries 6, boolean chains 5, error handling 3 (5 pts), loops 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
PairingManager.handle_join_request (cognitive 37) REDACTED:1224— PairingManager.handle_join_request has cognitive complexity 37 (threshold 15). Drivers by points: if/else 15 (17 pts), boolean chains 15, error handling 2 (3 pts), loops 1, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
VLMBatchedEngine._try_build_cached_vision_inputs (cognitive 37) omlx/engine/vlm.py:3679— VLMBatchedEngine._try_build_cached_vision_inputs has cognitive complexity 37 (threshold 15). Drivers by points: if/else 17 (24 pts), boolean chains 6, loops 3 (4 pts), ternaries 2, 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.
BaseBenchmark.run (cognitive 37) omlx/eval/base.py:350— BaseBenchmark.run has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (19 pts), loops 7 (10 pts), ternaries 2 (4 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
batch_generator._chain_next_drafts (cognitive 37) REDACTED:3169— batch_generator._chain_next_drafts has cognitive complexity 37 (threshold 15). Drivers by points: if/else 18 (25 pts), ternaries 4 (6 pts), boolean chains 5, 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.
moe_expert_offload._resolve_store_view (cognitive 37) omlx/patches/moe_expert_offload.py:979— moe_expert_offload._resolve_store_view has cognitive complexity 37 (threshold 15). Drivers by points: if/else 9 (23 pts), loops 4 (7 pts), ternaries 4 (6 pts), boolean chains 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Scheduler._build_sampler_and_processors (cognitive 37) omlx/scheduler.py:8459— Scheduler._build_sampler_and_processors has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (23 pts), ternaries 5 (8 pts), boolean chains 4, error handling 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Scheduler._prepare_prompt_boundary_cache_store (cognitive 37) omlx/scheduler.py:10045— Scheduler._prepare_prompt_boundary_cache_store has cognitive complexity 37 (threshold 15). Drivers by points: if/else 16 (29 pts), boolean chains 4, ternaries 2 (4 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ServerScreenVM.restart (cognitive 37) apps/omlx-mac/Sources/AppView/ViewModels/ServerScreenVM.swift:644— ServerScreenVM.restart has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (25 pts), ternaries 2 (6 pts), boolean chains 5, error handling 1 (nesting depth added 19). 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.
dashboard.dashboard.saveGlobalSettings (cognitive 37) REDACTED:1402— dashboard.dashboard.saveGlobalSettings has cognitive complexity 37 (threshold 15). Drivers by points: if/else 21 (25 pts), boolean chains 9, ternaries 2, error handling 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
benchmark._log_ane_benchmark_trace (cognitive 36) omlx/admin/benchmark.py:1032— benchmark._log_ane_benchmark_trace has cognitive complexity 36 (threshold 15). Drivers by points: boolean chains 16, ternaries 9 (16 pts), if/else 3, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
routes.clear_hot_cache (cognitive 36) omlx/admin/routes.py:7541— routes.clear_hot_cache has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (20 pts), error handling 4 (10 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
oq._load_hf_calibration (cognitive 36) omlx/oq.py:8156— oq._load_hf_calibration has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (22 pts), error handling 4 (9 pts), loops 2 (4 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.
deepseek_v4_model._batch_indexer_rows (cognitive 36) omlx/patches/deepseek_v4/deepseek_v4_model.py:1549— deepseek_v4_model._batch_indexer_rows has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (22 pts), error handling 2 (6 pts), loops 3 (5 pts), boolean chains 3 (nesting depth added 18). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
GlmMoeDsaAttention.__call__ (cognitive 36) omlx/patches/glm_moe_dsa/glm_moe_dsa_model.py:185— GlmMoeDsaAttention.__call__ has cognitive complexity 36 (threshold 15). Drivers by points: if/else 20 (29 pts), boolean chains 6, ternaries 1 (nesting depth added 9). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
Scheduler._normalize_rotating_snapshot_state (cognitive 36) omlx/scheduler.py:10261— Scheduler._normalize_rotating_snapshot_state has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 10 (14 pts), boolean chains 9, if/else 7 (8 pts), error handling 3 (5 pts) (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
Scheduler._route_to_vlm_mtp (cognitive 36) omlx/scheduler.py:11496— Scheduler._route_to_vlm_mtp has cognitive complexity 36 (threshold 15). Drivers by points: if/else 21 (24 pts), boolean chains 7, error handling 2, ternaries 2, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
harmony.parse_tool_calls_from_tokens (cognitive 35) omlx/adapter/harmony.py:428— harmony.parse_tool_calls_from_tokens has cognitive complexity 35 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 5 (11 pts), boolean chains 2, ternaries 1 (2 pts), error handling 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ToolCallStreamFilter._unwind_withheld_at_eof (cognitive 35) omlx/api/tool_calling.py:3462— ToolCallStreamFilter._unwind_withheld_at_eof has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (28 pts), loops 3 (4 pts), ternaries 1 (3 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PagedSSDCacheManager.load_block_with_metadata (cognitive 35) omlx/cache/paged_ssd_cache.py:4365— PagedSSDCacheManager.load_block_with_metadata has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (18 pts), error handling 4 (8 pts), boolean chains 6, ternaries 1 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
base._run_scheduler_preflight_with_cleanup_retry (cognitive 35) omlx/engine/base.py:87— base._run_scheduler_preflight_with_cleanup_retry has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (24 pts), boolean chains 8, ternaries 1 (2 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BatchedEngine._apply_chat_template (cognitive 35) REDACTED:925— BatchedEngine._apply_chat_template has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 2 (7 pts), error handling 2 (4 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
VLMBatchedEngine._apply_chat_template (cognitive 35) omlx/engine/vlm.py:4683— VLMBatchedEngine._apply_chat_template has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (24 pts), loops 2 (7 pts), error handling 2 (4 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
vlm._gemma4_global_kv_from_per_layer_config (cognitive 35) omlx/engine/vlm.py:781— vlm._gemma4_global_kv_from_per_layer_config has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (22 pts), error handling 2 (7 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EnginePool._stop_and_unload_engine (cognitive 35) omlx/engine_pool.py:3758— EnginePool._stop_and_unload_engine has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 6, ternaries 5 (6 pts), loops 3 (4 pts), error handling 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MLXEmbeddingModel._embed_batch (cognitive 35) omlx/models/embedding.py:1092— MLXEmbeddingModel._embed_batch has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (25 pts), loops 2 (6 pts), error handling 1 (3 pts), boolean chains 1 (nesting depth added 19). 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.
oq._quantize_chunked (cognitive 35) omlx/oq.py:6774— oq._quantize_chunked has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 7, loops 4 (6 pts), ternaries 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BatchPoolingCache.merge (cognitive 35) omlx/patches/deepseek_v4/cache_extras.py:1147— BatchPoolingCache.merge has cognitive complexity 35 (threshold 15). Drivers by points: if/else 15 (28 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
decode_kernels.moe_down_combine (cognitive 35) omlx/patches/mlx_vlm_glm5_next_compat/decode_kernels.py:936— decode_kernels.moe_down_combine has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 11, ternaries 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Scheduler._drain_pending_async_removes (cognitive 35) omlx/scheduler.py:3061— Scheduler._drain_pending_async_removes has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (26 pts), error handling 2 (6 pts), boolean chains 2, loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Gemma4OutputParserSession._consume_text (cognitive 34) omlx/adapter/gemma4.py:373— Gemma4OutputParserSession._consume_text has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (30 pts), boolean chains 3, loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PagedSSDCacheManager._is_compatible_cache_signature (cognitive 34) omlx/cache/paged_ssd_cache.py:2860— PagedSSDCacheManager._is_compatible_cache_signature has cognitive complexity 34 (threshold 15). Drivers by points: if/else 15 (20 pts), boolean chains 7, error handling 3 (5 pts), ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
launch.build_mlx_launch_argv (cognitive 34) omlx/cluster/launch.py:1188— launch.build_mlx_launch_argv has cognitive complexity 34 (threshold 15). Drivers by points: if/else 21 (25 pts), boolean chains 4, error handling 2 (4 pts), loops 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
PairingManager.approve (cognitive 34) REDACTED:1341— PairingManager.approve has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (20 pts), error handling 5 (8 pts), boolean chains 4, ternaries 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
vlm._audio_feature_cache_key_ranges (cognitive 34) omlx/engine/vlm.py:1627— vlm._audio_feature_cache_key_ranges has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 4 (6 pts), boolean chains 5, ternaries 2 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
batched_head.draft (cognitive 34) omlx/patches/mlx_lm_mtp/batched_head.py:90— batched_head.draft has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (17 pts), loops 6 (10 pts), ternaries 3 (4 pts), boolean chains 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
qwen35_ane_prefill._backend_exact (cognitive 34) omlx/patches/qwen35_ane_prefill.py:1762— qwen35_ane_prefill._backend_exact has cognitive complexity 34 (threshold 15). Drivers by points: if/else 18 (26 pts), error handling 3 (5 pts), boolean chains 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dashboard.applyANETuningRecommendation (cognitive 34) REDACTED:2919— dashboard.applyANETuningRecommendation has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 11, error handling 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
benchmark._filter_uploaded_settings (cognitive 33) omlx/admin/benchmark.py:432— benchmark._filter_uploaded_settings has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 4 (8 pts), boolean chains 3, error handling 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
affine4._native_attention (cognitive 33) omlx/affine4.py:767— affine4._native_attention has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 9, ternaries 5 (6 pts), error handling 1, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
markitdown.stream_messages_to_markdown_async (cognitive 33) omlx/api/markitdown.py:200— markitdown.stream_messages_to_markdown_async has cognitive complexity 33 (threshold 15). Drivers by points: loops 6 (16 pts), if/else 7 (15 pts), boolean chains 2 (nesting depth added 18). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
staging.stage_files_from_source (cognitive 33) omlx/cluster/staging.py:1000— staging.stage_files_from_source has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (23 pts), boolean chains 4, ternaries 4, loops 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PipelinedTextModel.__call__ (cognitive 33) omlx/patches/glm5_next_mlx_lm/model.py:86— PipelinedTextModel.__call__ has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (17 pts), ternaries 8 (11 pts), boolean chains 4, loops 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
norm_repair.repair_legacy_head_norms (cognitive 33) omlx/patches/mlx_lm_mtp/norm_repair.py:51— norm_repair.repair_legacy_head_norms has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 5 (7 pts), error handling 2 (6 pts), boolean chains 2, ternaries 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
qwen35_fa256_attention.apply_qwen35_fa256_attention_patch (cognitive 33) omlx/patches/qwen35_fa256_attention.py:323— qwen35_fa256_attention.apply_qwen35_fa256_attention_patch has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 4, error handling 3 (4 pts), loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
server._build_format_element (cognitive 33) REDACTED:5665— server._build_format_element has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (24 pts), ternaries 3 (9 pts) (nesting depth added 19). 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.
target.run_specprefill_target_prefill (cognitive 33) omlx/specprefill/target.py:57— target.run_specprefill_target_prefill has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 5, ternaries 3 (5 pts), error handling 2 (4 pts), loops 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TalkAIController.handle (cognitive 33) apps/omlx-mac/Sources/AskAI/TalkAIController.swift:331— TalkAIController.handle has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (26 pts), boolean chains 4, ternaries 1 (2 pts), match/switch 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.
dashboard.dashboard.applyANETuningRecommendation (cognitive 33) REDACTED:2919— dashboard.dashboard.applyANETuningRecommendation has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 11, 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.
InklingOutputParserSession.finalize (cognitive 32) omlx/adapter/output_parser.py:1077— InklingOutputParserSession.finalize has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (17 pts), error handling 3 (9 pts), ternaries 2 (3 pts), boolean chains 2, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MSDownloader.get_model_info (cognitive 32) omlx/admin/ms_downloader.py:588— MSDownloader.get_model_info has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 7, error handling 4 (7 pts), ternaries 2 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
anthropic_utils._normalize_in_messages_system (cognitive 32) omlx/api/anthropic_utils.py:737— anthropic_utils._normalize_in_messages_system has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (25 pts), loops 2 (4 pts), ternaries 2 (3 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
responses_utils.convert_responses_tools (cognitive 32) omlx/api/responses_utils.py:434— responses_utils.convert_responses_tools has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (23 pts), boolean chains 4, loops 2 (4 pts), ternaries 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tool_calling._scan_gemma4_args_span (cognitive 32) omlx/api/tool_calling.py:1436— tool_calling._scan_gemma4_args_span has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (27 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PagedSSDCacheManager._scan_existing_files (cognitive 32) omlx/cache/paged_ssd_cache.py:2446— PagedSSDCacheManager._scan_existing_files has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (19 pts), error handling 2 (7 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
VisionFeatureSSDCache._writer_loop (cognitive 32) omlx/cache/vision_feature_cache.py:544— VisionFeatureSSDCache._writer_loop has cognitive complexity 32 (threshold 15). Drivers by points: if/else 7 (18 pts), error handling 3 (8 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
VLMBatchedEngine._split_vision_features (cognitive 32) omlx/engine/vlm.py:3828— VLMBatchedEngine._split_vision_features has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (21 pts), loops 3 (7 pts), boolean chains 4 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EnginePool._entry_runtime_resident_size (cognitive 32) omlx/engine_pool.py:601— EnginePool._entry_runtime_resident_size has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (20 pts), ternaries 4 (8 pts), boolean chains 4 (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.
_TrackedTensor.__getitem__ (cognitive 32) omlx/oq.py:2922— _TrackedTensor.__getitem__ has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (22 pts), ternaries 3 (6 pts), loops 2 (4 pts) (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
oq._lookup_imatrix_importance (cognitive 32) omlx/oq.py:6366— oq._lookup_imatrix_importance has cognitive complexity 32 (threshold 15). Drivers by points: if/else 15 (22 pts), boolean chains 8, ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
m5_gather_qmm_nax.supports (cognitive 32) omlx/patches/m5_gather_qmm_nax.py:1322— m5_gather_qmm_nax.supports has cognitive complexity 32 (threshold 15). Drivers by points: if/else 16 (23 pts), boolean chains 9 (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.
batch_generator._post_init_mtp (cognitive 32) REDACTED:3343— batch_generator._post_init_mtp has cognitive complexity 32 (threshold 15). Drivers by points: if/else 16 (23 pts), boolean chains 4, error handling 1 (4 pts), ternaries 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
moe_expert_offload.apply_moe_expert_offload (cognitive 32) omlx/patches/moe_expert_offload.py:1045— moe_expert_offload.apply_moe_expert_offload has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (19 pts), loops 3 (6 pts), ternaries 3 (5 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
model_loading._add_glm5_next_nextn_quant_keys (cognitive 32) omlx/utils/model_loading.py:128— model_loading._add_glm5_next_nextn_quant_keys has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 3 (6 pts), boolean chains 4 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dashboard.dashboard.handleMainTabChange (cognitive 32) REDACTED:890— dashboard.dashboard.handleMainTabChange has cognitive complexity 32 (threshold 15). Drivers by points: if/else 17 (26 pts), boolean chains 6 (nesting depth added 9). Of this number, 30 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dashboard.dashboard.saveModelSettings (cognitive 32) REDACTED:3729— dashboard.dashboard.saveModelSettings has cognitive complexity 32 (threshold 15). Drivers by points: if/else 15 (20 pts), ternaries 2 (5 pts), boolean chains 4, loops 1 (2 pts), error handling 1 (nesting depth added 9). Of this number, 27 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dashboard.handleMainTabChange (cognitive 32) REDACTED:890— dashboard.handleMainTabChange has cognitive complexity 32 (threshold 15). Drivers by points: if/else 17 (26 pts), boolean chains 6 (nesting depth added 9). Of this number, 30 points are the body's own statements and 2 belong to 4 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dashboard.sortedModels (cognitive 32) REDACTED:7191— dashboard.sortedModels has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 12 (22 pts), boolean chains 6, if/else 3, match/switch 1 (nesting depth added 10). None of this is in the body itself: all 32 points belong to one function literal inside it that branches (line 7192). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
model_recommender.kv_cache_cost (cognitive 31) omlx/admin/model_recommender.py:647— model_recommender.kv_cache_cost has cognitive complexity 31 (threshold 15). Drivers by points: boolean chains 15, if/else 9 (11 pts), ternaries 2 (4 pts), loops 1 (nesting depth added 4). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
tool_calling.extract_tool_calls_with_thinking (cognitive 31) omlx/api/tool_calling.py:2467— tool_calling.extract_tool_calls_with_thinking has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (29 pts), boolean chains 2 (nesting depth added 18). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
PagedSSDCacheManager.close (cognitive 31) omlx/cache/paged_ssd_cache.py:5516— PagedSSDCacheManager.close has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (24 pts), error handling 1 (2 pts), loops 1 (2 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
catalogue.assess_model (cognitive 31) omlx/cluster/catalogue.py:345— catalogue.assess_model has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 5, loops 2 (3 pts), ternaries 1 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DiscoveryService._multicast_loop (cognitive 31) REDACTED:1563— DiscoveryService._multicast_loop has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (20 pts), error handling 5 (10 pts), loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DiscoveryService._probe_candidate (cognitive 31) REDACTED:1848— DiscoveryService._probe_candidate has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 9, ternaries 2, error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
discovery_routes.cluster_devices (cognitive 31) omlx/cluster/discovery_routes.py:305— discovery_routes.cluster_devices has cognitive complexity 31 (threshold 15). Drivers by points: loops 7 (11 pts), if/else 7 (10 pts), ternaries 5, error handling 4, 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.
ModelSyncManager.resolve_local_model_path (cognitive 31) REDACTED:415— ModelSyncManager.resolve_local_model_path has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (21 pts), loops 2 (4 pts), ternaries 3 (4 pts), boolean chains 2 (nesting depth added 15). 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.
routes._run_staging_job (cognitive 31) omlx/cluster/routes.py:1728— routes._run_staging_job has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 4, ternaries 2 (4 pts), error handling 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
runtime._validated_assignments (cognitive 31) omlx/cluster/runtime.py:91— runtime._validated_assignments has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (19 pts), loops 5 (7 pts), boolean chains 5 (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.
d3.decode_video (cognitive 31) omlx/models/d3.py:302— d3.decode_video has cognitive complexity 31 (threshold 15). Drivers by points: if/else 15 (21 pts), boolean chains 5, loops 2 (3 pts), error handling 2 (nesting depth added 7). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
Model._sanitize_layers (cognitive 31) omlx/patches/bailing_hybrid/bailing_hybrid_model.py:905— Model._sanitize_layers has cognitive complexity 31 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 4 (11 pts), boolean chains 2 (nesting depth added 18). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
batch_generator._call_backbone_impl (cognitive 31) REDACTED:2200— batch_generator._call_backbone_impl has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 4, ternaries 1 (3 pts), error handling 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Scheduler.shutdown (cognitive 31) omlx/scheduler.py:16240— Scheduler.shutdown has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (16 pts), error handling 5 (10 pts), ternaries 2 (5 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BatchTurboQuantKVCache.merge (cognitive 31) omlx/turboquant_kv.py:585— BatchTurboQuantKVCache.merge has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (15 pts), ternaries 4 (10 pts), loops 4, boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AdvancedPage.body (cognitive 31) apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1219— AdvancedPage.body has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 6, ternaries 3 (6 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
clusterV2Wizard.acceleratorRows (cognitive 31) apps/omlx-web/omlx_web/static/js/cluster_v2.js:1898— clusterV2Wizard.acceleratorRows has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 5 (12 pts), if/else 10 (11 pts), boolean chains 8 (nesting depth added 8). Most of this is not in the body itself: 1 of the 31 points is its own statement and the rest belongs to 3 function items inside it that branch (a function literal at line 1903, size, t). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
dashboard.saveModelSettings (cognitive 31) REDACTED:3729— dashboard.saveModelSettings has cognitive complexity 31 (threshold 15). Drivers by points: if/else 15 (20 pts), boolean chains 4, ternaries 2 (4 pts), loops 1 (2 pts), error handling 1 (nesting depth added 8). Of this number, 27 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
audio_routes.create_transcription (cognitive 30) omlx/api/audio_routes.py:513— audio_routes.create_transcription has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (14 pts), error handling 6 (9 pts), boolean chains 5, ternaries 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_XmlFunctionBoundary.feed (cognitive 30) omlx/api/tool_calling.py:556— _XmlFunctionBoundary.feed has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (26 pts), boolean chains 3, loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
paged_ssd_cache.cachelist_subtypes_from_cache_list (cognitive 30) omlx/cache/paged_ssd_cache.py:656— paged_ssd_cache.cachelist_subtypes_from_cache_list has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (15 pts), ternaries 2 (8 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BlockAwarePrefixCache._drop_superseded_arrays_snapshots (cognitive 30) omlx/cache/prefix_cache.py:4915— BlockAwarePrefixCache._drop_superseded_arrays_snapshots has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 4 (7 pts), boolean chains 4 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
discovery.local_addr_dicts (cognitive 30) REDACTED:886— discovery.local_addr_dicts has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (19 pts), ternaries 1 (4 pts), loops 1 (3 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DistributedJobSupervisor._drain (cognitive 30) omlx/cluster/launch.py:2892— DistributedJobSupervisor._drain has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (21 pts), boolean chains 5, error handling 1 (3 pts), loops 1 (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
launch.probe_remote_host (cognitive 30) omlx/cluster/launch.py:2212— launch.probe_remote_host has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (17 pts), ternaries 3 (6 pts), error handling 3 (5 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
runtime_optimizations.install_runtime_optimizations (cognitive 30) omlx/cluster/runtime_optimizations.py:274— runtime_optimizations.install_runtime_optimizations has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 10, ternaries 9 (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.
tensor_strategies.native_shard_is_layer_local (cognitive 30) omlx/cluster/tensor_strategies.py:186— tensor_strategies.native_shard_is_layer_local has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 3, ternaries 1 (3 pts), error handling 1, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
splash.scan_ssd_cache (cognitive 30) REDACTED:55— splash.scan_ssd_cache has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (20 pts), error handling 3 (7 pts), loops 2 (3 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
vlm._count_image_tokens_real (cognitive 30) omlx/engine/vlm.py:1572— vlm._count_image_tokens_real has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 3 (6 pts), boolean chains 5, error handling 1 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
model_discovery._read_model_context_length (cognitive 30) omlx/model_discovery.py:1015— model_discovery._read_model_context_length has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 3 (8 pts), error handling 2 (4 pts), boolean chains 3 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MLXEmbeddingModel.embed (cognitive 30) omlx/models/embedding.py:957— MLXEmbeddingModel.embed has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 9, ternaries 2 (3 pts), loops 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
_DiscoveredPlan.pop (cognitive 30) omlx/oq.py:3775— _DiscoveredPlan.pop has cognitive complexity 30 (threshold 15). Drivers by points: if/else 18 (21 pts), loops 2 (5 pts), boolean chains 4 (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.
oq.import_mtplx_sidecar (cognitive 30) omlx/oq.py:2285— oq.import_mtplx_sidecar has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 6, loops 2 (3 pts), 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.
chat_template_v4.sort_tool_results_by_call_order (cognitive 30) omlx/patches/deepseek_v4/chat_template_v4.py:569— chat_template_v4.sort_tool_results_by_call_order has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 3 (8 pts), boolean chains 4 (nesting depth added 17). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
chat_template_v4.relocate_mid_system_messages (cognitive 30) omlx/patches/deepseek_v4/chat_template_v4.py:776— chat_template_v4.relocate_mid_system_messages has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 3 (6 pts), ternaries 2 (4 pts), boolean chains 3 (nesting depth added 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
CompressedAttention.__call__ (cognitive 30) omlx/patches/deepseek_v4/deepseek_v4_model.py:1833— CompressedAttention.__call__ has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (14 pts), ternaries 7 (10 pts), boolean chains 6 (nesting depth added 6). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
ModelArgs.__post_init__ (cognitive 30) omlx/patches/laguna/laguna_model.py:144— ModelArgs.__post_init__ has cognitive complexity 30 (threshold 15). Drivers by points: if/else 18 (22 pts), boolean chains 4, ternaries 3 (4 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
sdpa_flash.sdpa_flash (cognitive 30) omlx/patches/mimo_v2/sdpa_flash.py:418— sdpa_flash.sdpa_flash has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 10, error handling 1 (2 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
mlx_audio_ming3._onnx_float_initializers (cognitive 30) omlx/patches/mlx_audio_ming3.py:469— mlx_audio_ming3._onnx_float_initializers has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 3 (6 pts), ternaries 1 (4 pts), boolean chains 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
websearch.run_fetch_url (cognitive 30) omlx/websearch.py:591— websearch.run_fetch_url has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (16 pts), error handling 5 (6 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelSettingsScreenVM.load (cognitive 30) apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:704— ModelSettingsScreenVM.load has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 7, ternaries 1 (3 pts), error handling 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ThroughputBenchScreenVM.pollResults (cognitive 30) apps/omlx-mac/Sources/AppView/ViewModels/ThroughputBenchScreenVM.swift:290— ThroughputBenchScreenVM.pollResults has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (18 pts), boolean chains 6, ternaries 1 (3 pts), error handling 1 (2 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ChatCompletionClient.stream (cognitive 30) apps/omlx-mac/Sources/AskAI/ChatCompletionStream.swift:274— ChatCompletionClient.stream has cognitive complexity 30 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 3 (9 pts), match/switch 1 (3 pts), error handling 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dashboard.openModelSettings (cognitive 30) REDACTED:3011— dashboard.openModelSettings has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 7, error handling 2 (5 pts), ternaries 1 (nesting depth added 7). Of this number, 29 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
dashboard.accBuildText (cognitive 30) REDACTED:6410— dashboard.accBuildText has cognitive complexity 30 (threshold 15). Drivers by points: loops 8 (11 pts), ternaries 4 (10 pts), if/else 4 (7 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ExternalAPIClient.stream_chat_completion (cognitive 29) omlx/admin/external_api.py:368— ExternalAPIClient.stream_chat_completion has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 6, error handling 2 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OQManager._run_quantization (cognitive 29) omlx/admin/oq_manager.py:599— OQManager._run_quantization has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (18 pts), error handling 5 (8 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PagedSSDCacheManager.invalidate_stale_layer_signature (cognitive 29) omlx/cache/paged_ssd_cache.py:4836— PagedSSDCacheManager.invalidate_stale_layer_signature has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 4, error handling 1 (2 pts), loops 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
routes._reconcile_runtime_ownership (cognitive 29) omlx/cluster/routes.py:2022— routes._reconcile_runtime_ownership has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 4 (5 pts), ternaries 2 (4 pts), error handling 2 (3 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
claude_desktop.restore (cognitive 29) omlx/integrations/claude_desktop.py:226— claude_desktop.restore has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OpenJevModel.encode (cognitive 29) omlx/models/openjev.py:260— OpenJevModel.encode has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 7, loops 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
openjev.split_state (cognitive 29) omlx/models/openjev.py:57— openjev.split_state has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (14 pts), ternaries 3 (10 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
omnimodal.export_sidecars (cognitive 29) omlx/patches/mimo_v2/omnimodal.py:30— omnimodal.export_sidecars has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 3 (7 pts), ternaries 1 (4 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
batch_generator._run_verify_cycle_batched (cognitive 29) REDACTED:3560— batch_generator._run_verify_cycle_batched has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (14 pts), ternaries 4 (7 pts), loops 4 (6 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProcessMemoryEnforcer._propagate_memory_limit (cognitive 29) omlx/process_memory_enforcer.py:1460— ProcessMemoryEnforcer._propagate_memory_limit has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (22 pts), ternaries 4, boolean chains 2, loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
server._render_chat_prompt_for_thinking_detection (cognitive 29) REDACTED:6304— server._render_chat_prompt_for_thinking_detection has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (19 pts), loops 2 (6 pts), error handling 2 (4 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.
embedding_utils._item_from_content_parts (cognitive 28) omlx/api/embedding_utils.py:195— embedding_utils._item_from_content_parts has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (23 pts), ternaries 1 (3 pts), boolean chains 1, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tool_calling.enrich_tool_params_for_gemma4 (cognitive 28) omlx/api/tool_calling.py:3812— tool_calling.enrich_tool_params_for_gemma4 has cognitive complexity 28 (threshold 15). Drivers by points: if/else 5 (14 pts), ternaries 2 (9 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
autoconfigure.preflight_issues (cognitive 28) omlx/cluster/autoconfigure.py:652— autoconfigure.preflight_issues has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 8, loops 2 (4 pts), ternaries 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
backends.members_from_host_records (cognitive 28) omlx/cluster/backends.py:118— backends.members_from_host_records has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (20 pts), loops 2 (4 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DiscoveryService._handle_mdns_service (cognitive 28) REDACTED:2108— DiscoveryService._handle_mdns_service has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 8, loops 2 (3 pts), error handling 2, 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.
base.chat_models (cognitive 28) omlx/integrations/base.py:71— base.chat_models has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 7, loops 2 (3 pts), error handling 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
memory_monitor.set_model_info_from_model (cognitive 28) REDACTED:2125— memory_monitor.set_model_info_from_model has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 11, error handling 2 (3 pts), loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
qwen35_ane_prefill._compile_gdn (cognitive 28) omlx/patches/qwen35_ane_prefill.py:1112— qwen35_ane_prefill._compile_gdn has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (15 pts), ternaries 8, boolean chains 5 (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.
Scheduler._insert_prefilled_request (cognitive 28) omlx/scheduler.py:7534— Scheduler._insert_prefilled_request has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (17 pts), ternaries 3 (4 pts), loops 1 (3 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
server.server_status (cognitive 28) REDACTED:3429— server.server_status has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 2 (4 pts), error handling 1 (3 pts), ternaries 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cluster_v2.clusterV2Wizard.acceleratorRows (cognitive 28) apps/omlx-web/omlx_web/static/js/cluster_v2.js:1898— cluster_v2.clusterV2Wizard.acceleratorRows has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (11 pts), ternaries 3 (9 pts), boolean chains 8 (nesting depth added 7). Most of this is not in the body itself: 1 of the 28 points is its own statement and the rest belongs to 2 function items inside it that branch (a function literal at line 1903, size). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
dashboard.dashboard.openModelSettings (cognitive 28) REDACTED:3011— dashboard.dashboard.openModelSettings has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 6, error handling 2 (5 pts) (nesting depth added 7). Of this number, 27 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
logs.aggregateLogRows (cognitive 28) REDACTED:71— logs.aggregateLogRows has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 6, loops 1 (nesting depth added 9). Of this number, 24 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
clusterV2Wizard.submitPairApproval (cognitive 28) apps/omlx-web/omlx_web/static/js/cluster_v2.js:1431— clusterV2Wizard.submitPairApproval has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 7, ternaries 1 (3 pts), error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
output_parser.detect_output_parser (cognitive 27) omlx/adapter/output_parser.py:1369— output_parser.detect_output_parser has cognitive complexity 27 (threshold 15). Drivers by points: if/else 16 (23 pts), loops 1 (2 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.
ToolCallStreamFilter._should_drop_tail_at_finish (cognitive 27) omlx/api/tool_calling.py:3349— ToolCallStreamFilter._should_drop_tail_at_finish has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (22 pts), loops 4, 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.
paged_ssd_cache._clamp_rotating_meta_states (cognitive 27) omlx/cache/paged_ssd_cache.py:699— paged_ssd_cache._clamp_rotating_meta_states has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (17 pts), boolean chains 5, error handling 1 (4 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BlockAwarePrefixCache.fetch_cache (cognitive 27) omlx/cache/prefix_cache.py:811— BlockAwarePrefixCache.fetch_cache has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 3 (7 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
launch.run_cuda_fabric_probe (cognitive 27) omlx/cluster/launch.py:1526— launch.run_cuda_fabric_probe has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 6, error handling 2 (3 pts), ternaries 2 (3 pts), loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
DeviceRegistry._coerce (cognitive 27) omlx/cluster/registry.py:436— DeviceRegistry._coerce has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (15 pts), ternaries 3 (7 pts), boolean chains 5 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
routes.cluster_cuda_fabric_verify (cognitive 27) omlx/cluster/routes.py:2681— routes.cluster_cuda_fabric_verify has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 11, if/else 6 (11 pts), error handling 3 (4 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DistributedBatchedEngine._write_rank_cancel_request (cognitive 27) omlx/engine/distributed.py:1072— DistributedBatchedEngine._write_rank_cancel_request has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 4, ternaries 3 (4 pts), error handling 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
engine_pool._qwen35_cpu_share_estimated_bytes (cognitive 27) omlx/engine_pool.py:198— engine_pool._qwen35_cpu_share_estimated_bytes has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 11, error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
memory_monitor._make_deepseek_v41_prefill_memory_profile (cognitive 27) REDACTED:1754— memory_monitor._make_deepseek_v41_prefill_memory_profile has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 7, loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PoolingCache.accumulate_windows (cognitive 27) omlx/patches/deepseek_v4/cache_extras.py:141— PoolingCache.accumulate_windows has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (16 pts), ternaries 2 (6 pts), boolean chains 3, error handling 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ane_prefill.enable_ane_prefill (cognitive 27) omlx/patches/k2_horizon/ane_prefill.py:277— ane_prefill.enable_ane_prefill has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 5, ternaries 2 (5 pts), loops 3 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
qwen35_ane_prefill.ane_prefill_transient_bytes (cognitive 27) omlx/patches/qwen35_ane_prefill.py:3487— qwen35_ane_prefill.ane_prefill_transient_bytes has cognitive complexity 27 (threshold 15). Drivers by points: if/else 4 (14 pts), loops 4 (8 pts), error handling 1 (4 pts), ternaries 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Scheduler._find_relevant_inflight_store (cognitive 27) omlx/scheduler.py:10806— Scheduler._find_relevant_inflight_store has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 6, 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.
Scheduler._init_tiered_cache (cognitive 27) omlx/scheduler.py:16784— Scheduler._init_tiered_cache has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (15 pts), ternaries 4 (6 pts), boolean chains 3, error handling 2 (3 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
draft.run_specprefill_draft_scoring (cognitive 27) omlx/specprefill/draft.py:92— draft.run_specprefill_draft_scoring has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (15 pts), error handling 4 (7 pts), boolean chains 4, ternaries 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UsageHistoryView.body (cognitive 27) apps/omlx-mac/Sources/AppView/Screens/UsageHistoryView.swift:16— UsageHistoryView.body has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (17 pts), error handling 2 (4 pts), ternaries 1 (4 pts), boolean chains 1, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dashboard.dashboard.updateModelSetting (cognitive 27) REDACTED:1641— dashboard.dashboard.updateModelSetting has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (25 pts), boolean chains 1, error handling 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
clusterV2Wizard.runPlan (cognitive 27) apps/omlx-web/omlx_web/static/js/cluster_v2.js:2819— clusterV2Wizard.runPlan has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 14, if/else 9 (10 pts), ternaries 2, error handling 1 (nesting depth added 1). Of this number, 24 points are the body's own statements and 3 belong to 6 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
dashboard.updateModelSetting (cognitive 27) REDACTED:1641— dashboard.updateModelSetting has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (25 pts), boolean chains 1, error handling 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BoundarySnapshotSSDStore._write_inline (cognitive 26) omlx/cache/boundary_snapshot_store.py:939— BoundarySnapshotSSDStore._write_inline has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 5, error handling 2 (4 pts), loops 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.
BlockAwarePrefixCache._block_token_count_matches_slices (cognitive 26) omlx/cache/prefix_cache.py:1960— BlockAwarePrefixCache._block_token_count_matches_slices has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 7, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
VisionFeatureSSDCache._scan_existing_files (cognitive 26) omlx/cache/vision_feature_cache.py:474— VisionFeatureSSDCache._scan_existing_files has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (14 pts), error handling 2 (7 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.diagnose_menubar (cognitive 26) REDACTED:846— cli.diagnose_menubar has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 3 (5 pts), ternaries 3 (4 pts), boolean chains 3, error handling 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
inference_worker.run_worker (cognitive 26) omlx/cluster/inference_worker.py:1308— inference_worker.run_worker has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 5, ternaries 5, error handling 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
VLMBatchedEngine._diffusion_apply_chat_template (cognitive 26) omlx/engine/vlm.py:5694— VLMBatchedEngine._diffusion_apply_chat_template has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 2 (7 pts), error handling 4 (5 pts), boolean chains 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Integration.select_model (cognitive 26) omlx/integrations/base.py:173— Integration.select_model has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (12 pts), error handling 3 (6 pts), ternaries 2 (4 pts), loops 3, boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
copilot.copilot_provider_config (cognitive 26) omlx/integrations/copilot.py:50— copilot.copilot_provider_config has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (19 pts), boolean chains 6, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
d3.normalize_question (cognitive 26) omlx/models/d3.py:112— d3.normalize_question has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 7, ternaries 1 (2 pts) (nesting depth added 8). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
_LazyTensorIndex._discover_fp8_pairs (cognitive 26) omlx/oq.py:5533— _LazyTensorIndex._discover_fp8_pairs has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 7, loops 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
oq._plan_mtp_head (cognitive 26) omlx/oq.py:1831— oq._plan_mtp_head has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
oq._collect_mtp_head_imatrix (cognitive 26) omlx/oq.py:9413— oq._collect_mtp_head_imatrix has cognitive complexity 26 (threshold 15). Drivers by points: if/else 15 (18 pts), boolean chains 5, ternaries 1 (2 pts), error handling 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
BatchPoolingCache.extend (cognitive 26) omlx/patches/deepseek_v4/cache_extras.py:1017— BatchPoolingCache.extend has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 5 (11 pts), boolean chains 4 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Scheduler._step_vlm_mtp (cognitive 26) omlx/scheduler.py:11817— Scheduler._step_vlm_mtp has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (17 pts), error handling 2 (4 pts), loops 2, ternaries 1 (2 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
network._local_ipv4_addresses (cognitive 26) omlx/utils/network.py:166— network._local_ipv4_addresses has cognitive complexity 26 (threshold 15). Drivers by points: if/else 4 (11 pts), error handling 4 (10 pts), loops 3 (5 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
build._lock_with_sdist_retry (cognitive 26) REDACTED:332— build._lock_with_sdist_retry has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (23 pts), boolean chains 2, loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cluster_v2.clusterV2Wizard.runPlan (cognitive 26) apps/omlx-web/omlx_web/static/js/cluster_v2.js:2819— cluster_v2.clusterV2Wizard.runPlan has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 14, if/else 9 (10 pts), error handling 1, ternaries 1 (nesting depth added 1). Of this number, 23 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
auth.require_admin (cognitive 25) REDACTED:386— auth.require_admin has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (18 pts), ternaries 2 (4 pts), boolean chains 3 (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.
HFUploader._run_upload (cognitive 25) omlx/admin/hf_uploader.py:673— HFUploader._run_upload has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (17 pts), error handling 4 (6 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
audio_routes.create_speech (cognitive 25) omlx/api/audio_routes.py:1529— audio_routes.create_speech has cognitive complexity 25 (threshold 15). Drivers by points: error handling 8 (12 pts), if/else 8 (9 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
decisions.decisions_request (cognitive 25) omlx/api/decisions.py:465— decisions.decisions_request has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 6, error handling 1 (2 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PagedSSDCacheManager.preload_matched_blocks (cognitive 25) omlx/cache/paged_ssd_cache.py:4622— PagedSSDCacheManager.preload_matched_blocks has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (16 pts), error handling 2 (5 pts), loops 3, 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.
BlockAwarePrefixCache.fetch_exact_prefix (cognitive 25) omlx/cache/prefix_cache.py:1877— BlockAwarePrefixCache.fetch_exact_prefix has cognitive complexity 25 (threshold 15). Drivers by points: loops 5 (13 pts), if/else 5 (11 pts), boolean chains 1 (nesting depth added 14). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
PairingSession._begin (cognitive 25) omlx/cluster/pairing_session.py:198— PairingSession._begin has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 6 (9 pts), if/else 6 (8 pts), boolean chains 4, error handling 4 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_DeepSeekV4PrefillMemoryProfile.estimate_prefill_transient_bytes (cognitive 25) REDACTED:1238— _DeepSeekV4PrefillMemoryProfile.estimate_prefill_transient_bytes has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 5 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
oq._load_builtin_calibration (cognitive 25) omlx/oq.py:8087— oq._load_builtin_calibration has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (11 pts), loops 5 (9 pts), ternaries 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.
_SlotCache.ensure_ids (cognitive 25) omlx/patches/glm_moe_dsa/moe_offload.py:198— _SlotCache.ensure_ids has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (19 pts), loops 4 (5 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
m5_gather_qmm_a8._self_test_extended (cognitive 25) omlx/patches/m5_gather_qmm_a8.py:1285— m5_gather_qmm_a8._self_test_extended has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (17 pts), ternaries 4 (6 pts), boolean chains 1, error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
batch_generator._emit_ragged_responses (cognitive 25) REDACTED:3661— batch_generator._emit_ragged_responses has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 3 (4 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
qwen35_ane_prefill._enable_fused_down_banks (cognitive 25) omlx/patches/qwen35_ane_prefill.py:2811— qwen35_ane_prefill._enable_fused_down_banks has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 3 (5 pts), error handling 1 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
specprefill.sparse_prefill (cognitive 25) omlx/patches/specprefill.py:975— specprefill.sparse_prefill has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (18 pts), loops 4 (6 pts), 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.
sampling.make_sampler (cognitive 25) omlx/utils/sampling.py:202— sampling.make_sampler has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 4 (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.
cluster_v2.clusterV2Wizard.submitPairApproval (cognitive 25) apps/omlx-web/omlx_web/static/js/cluster_v2.js:1431— cluster_v2.clusterV2Wizard.submitPairApproval has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 7, error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ane_tuning._settings_for_candidate (cognitive 24) omlx/admin/ane_tuning.py:445— ane_tuning._settings_for_candidate has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13, boolean chains 9, loops 1 (2 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
HFDownloader.get_model_info (cognitive 24) REDACTED:1590— HFDownloader.get_model_info has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 6 (7 pts), boolean chains 6, error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MSDownloader._poll_progress (cognitive 24) omlx/admin/ms_downloader.py:1066— MSDownloader._poll_progress has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 3, error handling 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
audio_routes.realtime_voice (cognitive 24) omlx/api/audio_routes.py:1001— audio_routes.realtime_voice has cognitive complexity 24 (threshold 15). Drivers by points: error handling 8 (9 pts), if/else 8 (9 pts), ternaries 3 (4 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
RankControlPlane.broadcast_owned_bytes (cognitive 24) REDACTED:436— RankControlPlane.broadcast_owned_bytes has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DistributedJobSupervisor._wait_for_ready (cognitive 24) omlx/cluster/launch.py:2945— DistributedJobSupervisor._wait_for_ready has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 4 (5 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
launch.probe_remote_admission_ceiling (cognitive 24) omlx/cluster/launch.py:2087— launch.probe_remote_admission_ceiling has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (7 pts), ternaries 3 (7 pts), boolean chains 6, error handling 3 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
liveness.check_peers (cognitive 24) omlx/cluster/liveness.py:317— liveness.check_peers has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 4 (11 pts), if/else 5 (9 pts), boolean chains 3, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
staging.stage_remote_files (cognitive 24) omlx/cluster/staging.py:1291— staging.stage_remote_files has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 4, loops 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
STTEngine._transcribe_stream_token_ids (cognitive 24) REDACTED:1052— STTEngine._transcribe_stream_token_ids has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 3 (6 pts), ternaries 2 (4 pts), boolean chains 3 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MLXEmbeddingModel._count_prepared_tokens (cognitive 24) omlx/models/embedding.py:1237— MLXEmbeddingModel._count_prepared_tokens has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (17 pts), ternaries 1 (3 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelArgs.__post_init__ (cognitive 24) omlx/patches/glm_moe_dsa/glm_moe_dsa_model.py:142— ModelArgs.__post_init__ has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (16 pts), ternaries 2 (7 pts), boolean chains 1 (nesting depth added 13). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
decode_fast.run_layers (cognitive 24) omlx/patches/mimo_v2/decode_fast.py:974— decode_fast.run_layers has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 4, ternaries 2 (4 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
sdpa256_attention.apply_sdpa256_attention_patch (cognitive 24) omlx/patches/sdpa256_attention.py:414— sdpa256_attention.apply_sdpa256_attention_patch has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 2 (4 pts), boolean chains 2, error handling 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.
ProcessMemoryEnforcer._shrink_hot_cache_by (cognitive 24) omlx/process_memory_enforcer.py:1282— ProcessMemoryEnforcer._shrink_hot_cache_by has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 4, 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.
Scheduler._detect_qwen35_prefill_floor (cognitive 24) omlx/scheduler.py:3348— Scheduler._detect_qwen35_prefill_floor has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 6, error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Scheduler._adaptive_chunk_size (cognitive 24) omlx/scheduler.py:5429— Scheduler._adaptive_chunk_size has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 4, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Scheduler._reserve_prefill_capacity (cognitive 24) omlx/scheduler.py:5720— Scheduler._reserve_prefill_capacity has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (18 pts), ternaries 1 (3 pts), loops 2, boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
server._with_json_keepalive (cognitive 24) REDACTED:3233— server._with_json_keepalive has cognitive complexity 24 (threshold 15). Drivers by points: error handling 6 (12 pts), if/else 6 (11 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
model_loading.materialize_lazy_state (cognitive 24) omlx/utils/model_loading.py:1497— model_loading.materialize_lazy_state has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 4 (9 pts), boolean chains 2, ternaries 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.
build._generate_venvstacks_toml (cognitive 24) REDACTED:468— build._generate_venvstacks_toml has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 4 (8 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dashboard.dashboard.accBuildText (cognitive 24) REDACTED:6410— dashboard.dashboard.accBuildText has cognitive complexity 24 (threshold 15). Drivers by points: loops 8 (11 pts), if/else 4 (7 pts), ternaries 2 (4 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
recipe.decode_recipe (cognitive 23) omlx/admin/recipe.py:60— recipe.decode_recipe has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 6, error handling 3, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
routes._validate_model_settings (cognitive 23) omlx/admin/routes.py:3696— routes._validate_model_settings has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (16 pts), error handling 3 (5 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelCacheConfig.from_cache_list (cognitive 23) omlx/cache/hybrid_cache.py:64— ModelCacheConfig.from_cache_list has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 2 (4 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PagedSSDCacheManager.load_block (cognitive 23) omlx/cache/paged_ssd_cache.py:4207— PagedSSDCacheManager.load_block has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (13 pts), error handling 4 (6 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
cli.lifecycle_command (cognitive 23) REDACTED:790— cli.lifecycle_command has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (16 pts), error handling 2 (5 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
autoconfigure._walk_dispatch (cognitive 23) omlx/cluster/autoconfigure.py:890— autoconfigure._walk_dispatch has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
autoconfigure._walk_imports (cognitive 23) omlx/cluster/autoconfigure.py:969— autoconfigure._walk_imports has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 3 (7 pts), boolean chains 3 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
collective.run_local_pipeline_smoke (cognitive 23) omlx/cluster/collective.py:188— collective.run_local_pipeline_smoke has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (11 pts), ternaries 2 (4 pts), boolean chains 3, error handling 2 (3 pts), loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (collective._run_local_minimax_decode_smoke) 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.
collective._run_local_minimax_decode_smoke (cognitive 23) omlx/cluster/collective.py:279— collective._run_local_minimax_decode_smoke has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (11 pts), ternaries 2 (4 pts), boolean chains 3, error handling 2 (3 pts), loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (collective.run_local_pipeline_smoke) 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.
probe.parse_linux_interface_address (cognitive 23) omlx/cluster/probe.py:223— probe.parse_linux_interface_address has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (13 pts), error handling 2 (4 pts), loops 2 (3 pts), boolean chains 2, 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.
RealtimeVoiceSession._respond (cognitive 23) omlx/engine/realtime_voice.py:312— RealtimeVoiceSession._respond has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (4 pts), error handling 3, boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
VLMBatchedEngine._apply_ocr_prompt (cognitive 23) omlx/engine/vlm.py:5473— VLMBatchedEngine._apply_ocr_prompt has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 4, 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.
ModelSettingsManager._validate_exposed_profile_ids_available_locked (cognitive 23) omlx/model_settings.py:1402— ModelSettingsManager._validate_exposed_profile_ids_available_locked has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 4 (6 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
oq.validate_quantizable (cognitive 23) omlx/oq.py:3900— oq.validate_quantizable has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (21 pts), boolean chains 2 (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
oq._prepare_gemma4_layer_inputs (cognitive 23) omlx/oq.py:8350— oq._prepare_gemma4_layer_inputs has cognitive complexity 23 (threshold 15). Drivers by points: if/else 15 (19 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
chat_template_v4.merge_tool_messages (cognitive 23) omlx/patches/deepseek_v4/chat_template_v4.py:499— chat_template_v4.merge_tool_messages has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 12). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
m5_gather_qmm_a8._launch (cognitive 23) omlx/patches/m5_gather_qmm_a8.py:822— m5_gather_qmm_a8._launch has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 13 (15 pts), if/else 5, boolean chains 3 (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.
qwen35_verify_attention.verify_attention (cognitive 23) omlx/patches/mlx_vlm_mtp/qwen35_verify_attention.py:178— qwen35_verify_attention.verify_attention has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 7 (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.
qwen35_q4_mlp._is_supported_affine_linear_shape (cognitive 23) omlx/patches/qwen35_q4_mlp.py:140— qwen35_q4_mlp._is_supported_affine_linear_shape has cognitive complexity 23 (threshold 15). Drivers by points: if/else 15, boolean chains 8. 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.
Scheduler._apply_turboquant_kv_convert (cognitive 23) omlx/scheduler.py:4138— Scheduler._apply_turboquant_kv_convert has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (4 pts), ternaries 2 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Scheduler._align_minimax_m3_partial_cache_to_prefill_step (cognitive 23) omlx/scheduler.py:12027— Scheduler._align_minimax_m3_partial_cache_to_prefill_step has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 8, loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
ProfileGroup.chip (cognitive 23) apps/omlx-mac/Sources/AppView/Screens/ProfileViews.swift:181— ProfileGroup.chip has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 9 (11 pts), if/else 6 (7 pts), boolean chains 5 (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.
TalkAIPanelView.body (cognitive 23) apps/omlx-mac/Sources/AskAI/TalkAIPanel.swift:152— TalkAIPanelView.body has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 7 (12 pts), if/else 8, boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
clusterV2Wizard.wizardState (cognitive 23) apps/omlx-web/omlx_web/static/js/cluster_v2.js:1069— clusterV2Wizard.wizardState has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 12, if/else 11. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
routes._apply_settings_snapshot (cognitive 22) omlx/admin/routes.py:4088— routes._apply_settings_snapshot has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (14 pts), error handling 2 (4 pts), loops 1 (2 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.
audio_routes._stream_speech_response (cognitive 22) omlx/api/audio_routes.py:341— audio_routes._stream_speech_response has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 3, loops 2 (3 pts), error handling 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
audio_routes.realtime_transcription (cognitive 22) omlx/api/audio_routes.py:693— audio_routes.realtime_transcription has cognitive complexity 22 (threshold 15). Drivers by points: error handling 9, if/else 8 (9 pts), boolean chains 3, loops 1 (nesting depth added 1). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
responses_utils.normalize_response_output_to_messages (cognitive 22) omlx/api/responses_utils.py:800— responses_utils.normalize_response_output_to_messages has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 2 (4 pts), ternaries 1 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BlockAwarePrefixCache._find_walk_back_truncation_point (cognitive 22) omlx/cache/prefix_cache.py:3037— BlockAwarePrefixCache._find_walk_back_truncation_point has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 3 (4 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
autoconfigure.order_hosts_for_topology (cognitive 22) omlx/cluster/autoconfigure.py:487— autoconfigure.order_hosts_for_topology has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 3 (4 pts), ternaries 2, boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DiscoveryService._rehydrate_paired_candidates (cognitive 22) REDACTED:1348— DiscoveryService._rehydrate_paired_candidates has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 4, error handling 2 (4 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
staging.stage_manifest (cognitive 22) omlx/cluster/staging.py:493— staging.stage_manifest has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 3 (5 pts), boolean chains 3, loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
staging.scp_copy (cognitive 22) omlx/cluster/staging.py:864— staging.scp_copy has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 1, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
codex.write_codex_config (cognitive 22) omlx/integrations/codex.py:280— codex.write_codex_config has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 3, error handling 1 (2 pts), loops 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MLXEmbeddingModel._count_tokens (cognitive 22) omlx/models/embedding.py:1201— MLXEmbeddingModel._count_tokens has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 4 (12 pts), if/else 5 (9 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
oq._normalize_sensitivity_map_override (cognitive 22) omlx/oq.py:481— oq._normalize_sensitivity_map_override has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 5, error handling 2 (4 pts), loops 1, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
oq._oqe_calibration_batch_plan (cognitive 22) omlx/oq.py:4443— oq._oqe_calibration_batch_plan has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 6, ternaries 4 (6 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_SlotCache.ensure_ids (cognitive 22) omlx/patches/deepseek_v4/moe_offload.py:159— _SlotCache.ensure_ids has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 5 (7 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.
tool_parser._parse_group_body (cognitive 22) omlx/patches/k2_horizon/tool_parser.py:62— tool_parser._parse_group_body has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 4 (8 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
batch_generator._run_verify_cycle_legacy (cognitive 22) REDACTED:4838— batch_generator._run_verify_cycle_legacy has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (15 pts), ternaries 3 (4 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.
qwen35_ane_prefill._compile_pair (cognitive 22) omlx/patches/qwen35_ane_prefill.py:597— qwen35_ane_prefill._compile_pair has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11, ternaries 6, boolean chains 5. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Scheduler._reschedule_generation_overflow_requests (cognitive 22) omlx/scheduler.py:15252— Scheduler._reschedule_generation_overflow_requests has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 6, boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Scheduler._process_pending_memory_requeue (cognitive 22) omlx/scheduler.py:15480— Scheduler._process_pending_memory_requeue has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 5, error handling 1 (2 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
server.list_models_status (cognitive 22) REDACTED:3974— server.list_models_status has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 5, 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.
GlobalSettings._load_from_file (cognitive 22) omlx/settings.py:1145— GlobalSettings._load_from_file has cognitive complexity 22 (threshold 15). Drivers by points: if/else 18, error handling 3 (4 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
repack_ternary_t5.repack_model (cognitive 22) scripts/repack_ternary_t5.py:307— repack_ternary_t5.repack_model has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 2, loops 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LibrarySection.body (cognitive 22) apps/omlx-mac/Sources/AppView/Screens/ModelsScreen.swift:204— LibrarySection.body has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (15 pts), ternaries 3 (6 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PerformanceScreenVM.resetDefaults (cognitive 22) apps/omlx-mac/Sources/AppView/ViewModels/PerformanceScreenVM.swift:77— PerformanceScreenVM.resetDefaults has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 2 (6 pts), boolean chains 2, error handling 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AppConfig.load (cognitive 22) apps/omlx-mac/Sources/Config/AppConfig.swift:287— AppConfig.load has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 5 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dashboard.prefillHelperStatusText (cognitive 22) REDACTED:3284— dashboard.prefillHelperStatusText has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 6, ternaries 3 (6 pts), if/else 3 (5 pts), other 4, match/switch 1 (nesting depth added 5). Of this number, 21 points are the body's own statements and 1 belongs to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dashboard.connectBenchSSE::onmessage (cognitive 22) REDACTED:5441— dashboard.connectBenchSSE::onmessage has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 3, error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
markitdown.preprocess_markitdown_file_parts (cognitive 21) omlx/api/markitdown.py:291— markitdown.preprocess_markitdown_file_parts has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (3 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (markitdown.preprocess_markitdown_file_parts_async) 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.
markitdown.preprocess_markitdown_file_parts_async (cognitive 21) omlx/api/markitdown.py:372— markitdown.preprocess_markitdown_file_parts_async has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (3 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (markitdown.preprocess_markitdown_file_parts) 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.
PagedSSDCacheManager.signature_mismatch_reason (cognitive 21) omlx/cache/paged_ssd_cache.py:2969— PagedSSDCacheManager.signature_mismatch_reason has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 6, ternaries 2 (3 pts), error handling 1, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
VisionFeatureSSDCache._load_from_ssd (cognitive 21) omlx/cache/vision_feature_cache.py:406— VisionFeatureSSDCache._load_from_ssd has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (15 pts), error handling 2 (3 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
autoconfigure.build_rdma_matrix (cognitive 21) omlx/cluster/autoconfigure.py:386— autoconfigure.build_rdma_matrix has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 2 (6 pts), loops 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
probe.detect_accelerator_hardware (cognitive 21) omlx/cluster/probe.py:72— probe.detect_accelerator_hardware has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 9, boolean chains 5, error handling 3 (4 pts), if/else 1 (2 pts), loops 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
DeviceRegistry.merge (cognitive 21) omlx/cluster/registry.py:377— DeviceRegistry.merge has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 4, error handling 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
transport.verify_link_reachability (cognitive 21) omlx/cluster/transport.py:1614— transport.verify_link_reachability has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (12 pts), ternaries 2 (5 pts), boolean chains 3, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
VLMBatchedEngine.stream_generate (cognitive 21) omlx/engine/vlm.py:4950— VLMBatchedEngine.stream_generate has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 5, ternaries 2 (4 pts), loops 2 (3 pts), error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
memory_monitor.estimate_mla_kv_bytes_per_token (cognitive 21) REDACTED:2044— memory_monitor.estimate_mla_kv_bytes_per_token has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 3, error handling 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MLXLanguageModel.stream_generate (cognitive 21) omlx/models/llm.py:190— MLXLanguageModel.stream_generate has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (11 pts), ternaries 2 (5 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
oq._prepare_layer_inputs (cognitive 21) omlx/oq.py:8949— oq._prepare_layer_inputs has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
oq._measure_sensitivity_from_model (cognitive 21) omlx/oq.py:11203— oq._measure_sensitivity_from_model has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4, ternaries 2 (4 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
deepseek_v4_model._stage_full_rotating_verify_view (cognitive 21) omlx/patches/deepseek_v4/deepseek_v4_model.py:1175— deepseek_v4_model._stage_full_rotating_verify_view has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 9). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
ane_prefill.prefill_memory_reservation (cognitive 21) omlx/patches/k2_horizon/ane_prefill.py:240— ane_prefill.prefill_memory_reservation has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 4 (10 pts), if/else 2 (5 pts), boolean chains 3, loops 2 (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.
prompt_priming._prepare_prefix_context (cognitive 21) REDACTED:601— prompt_priming._prepare_prefix_context has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9, boolean chains 8, error handling 3, ternaries 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
inkling_vlm_runtime._inkling_prime_capture (cognitive 21) omlx/patches/mlx_vlm_mtp/inkling_vlm_runtime.py:813— inkling_vlm_runtime._inkling_prime_capture has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 5, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
qwen35_ane_prefill._gdn_backend (cognitive 21) omlx/patches/qwen35_ane_prefill.py:1681— qwen35_ane_prefill._gdn_backend has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (17 pts), ternaries 2, boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (qwen35_ane_prefill._backend) 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.
qwen35_ane_prefill._backend (cognitive 21) omlx/patches/qwen35_ane_prefill.py:2033— qwen35_ane_prefill._backend has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (17 pts), ternaries 2, boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (qwen35_ane_prefill._gdn_backend) 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.
qwen35_ane_prefill._bank_split_ladder (cognitive 21) omlx/patches/qwen35_ane_prefill.py:2181— qwen35_ane_prefill._bank_split_ladder has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (3 pts), error handling 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (qwen35_ane_prefill._compile_single_banks) 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.
qwen35_ane_prefill._compile_single_banks (cognitive 21) omlx/patches/qwen35_ane_prefill.py:2309— qwen35_ane_prefill._compile_single_banks has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (3 pts), error handling 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (qwen35_ane_prefill._bank_split_ladder) 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.
qwen35_verify_qmm._pack_block (cognitive 21) omlx/patches/qwen35_verify_qmm.py:267— qwen35_verify_qmm._pack_block has cognitive complexity 21 (threshold 15). Drivers by points: loops 9 (19 pts), if/else 2 (nesting depth added 10). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
qwen35_verify_sdpa_split._vector_plan (cognitive 21) omlx/patches/qwen35_verify_sdpa_split.py:103— qwen35_verify_sdpa_split._vector_plan has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 5, ternaries 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HelperServer._run_chunks (cognitive 21) omlx/prefill_helper/worker.py:222— HelperServer._run_chunks has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 7, loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
scheduler._realigned_rows (cognitive 21) omlx/scheduler.py:809— scheduler._realigned_rows has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (13 pts), ternaries 2 (6 pts), boolean chains 1, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
model_loading.expand_glm_moe_dsa_fused_quant_keys (cognitive 21) omlx/utils/model_loading.py:272— model_loading.expand_glm_moe_dsa_fused_quant_keys has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ContextBenchScreenVM.pollStatus (cognitive 21) apps/omlx-mac/Sources/AppView/ViewModels/ContextBenchScreenVM.swift:181— ContextBenchScreenVM.pollStatus has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (15 pts), boolean chains 3, error handling 1 (2 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelSettingsScreenVM.validateAneWorkingSettings (cognitive 21) apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:2293— ModelSettingsScreenVM.validateAneWorkingSettings has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 8, match/switch 6, if/else 4 (5 pts), ternaries 2 (nesting depth added 1). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ServerProcess.tickHealth (cognitive 21) apps/omlx-mac/Sources/Server/ServerProcess.swift:501— ServerProcess.tickHealth has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 5, match/switch 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cluster_v2.clusterV2Wizard.wizardState (cognitive 21) apps/omlx-web/omlx_web/static/js/cluster_v2.js:1069— cluster_v2.clusterV2Wizard.wizardState has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11, boolean chains 10. 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.
cluster_v2.clusterV2Wizard.previewMembershipExpansion (cognitive 21) apps/omlx-web/omlx_web/static/js/cluster_v2.js:3517— cluster_v2.clusterV2Wizard.previewMembershipExpansion has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 16, if/else 3, error handling 1, ternaries 1. Of this number, 16 points are the body's own statements and 5 belong to 3 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
OQManager.cancel_quantization (cognitive 20) omlx/admin/oq_manager.py:507— OQManager.cancel_quantization has cognitive complexity 20 (threshold 15). Drivers by points: error handling 4 (10 pts), if/else 6, boolean chains 2, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
routes._scan_offline_gdn_sidecars (cognitive 20) omlx/admin/routes.py:6512— routes._scan_offline_gdn_sidecars has cognitive complexity 20 (threshold 15). Drivers by points: if/else 3 (9 pts), error handling 4 (8 pts), loops 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ThinkingBudgetProcessor._update_state (cognitive 20) omlx/api/thinking.py:572— ThinkingBudgetProcessor._update_state has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ToolCallStreamFilter.__init__ (cognitive 20) omlx/api/tool_calling.py:2637— ToolCallStreamFilter.__init__ has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 6, ternaries 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ToolCallStreamFilter.finish (cognitive 20) omlx/api/tool_calling.py:3677— ToolCallStreamFilter.finish has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tool_calling._merge_json_fragments (cognitive 20) omlx/api/tool_calling.py:221— tool_calling._merge_json_fragments has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (6 pts), ternaries 4 (5 pts), boolean chains 4, loops 2 (3 pts), error handling 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
tool_calling._find_marker_span_end (cognitive 20) omlx/api/tool_calling.py:838— tool_calling._find_marker_span_end has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PagedSSDCacheManager._scan_existing_gdn_sidecars (cognitive 20) omlx/cache/paged_ssd_cache.py:2548— PagedSSDCacheManager._scan_existing_gdn_sidecars has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (9 pts), error handling 2 (5 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
autoconfigure.peer_import_issues (cognitive 20) omlx/cluster/autoconfigure.py:1210— autoconfigure.peer_import_issues has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 4, error handling 2 (4 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SSDPromptSnapshotStore._load_manifest_or_reset (cognitive 20) omlx/cluster/prompt_snapshot_cache.py:552— SSDPromptSnapshotStore._load_manifest_or_reset has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 4, loops 2, error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
link_probe_service.serve_probe (cognitive 20) omlx/cluster/rdma/link_probe_service.py:32— link_probe_service.serve_probe has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
oq._apply_routed_layer_boosts (cognitive 20) omlx/oq.py:1204— oq._apply_routed_layer_boosts has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3 (4 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
oq.combine_mtp_donor (cognitive 20) omlx/oq.py:2582— oq.combine_mtp_donor has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3 (5 pts), boolean chains 2, ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
moe_offload.apply_deepseek_v4_moe_expert_offload (cognitive 20) omlx/patches/deepseek_v4/moe_offload.py:324— moe_offload.apply_deepseek_v4_moe_expert_offload has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 2, ternaries 1 (2 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
deepseek_v32._use_load_fused_wk_weights_proj (cognitive 20) omlx/patches/glm_moe_dsa/deepseek_v32.py:28— deepseek_v32._use_load_fused_wk_weights_proj has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 3, loops 2 (nesting depth added 5). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
m5_gather_qmm_a8.supports (cognitive 20) omlx/patches/m5_gather_qmm_a8.py:761— m5_gather_qmm_a8.supports has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11, boolean chains 9. 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.
prompt_priming._take_primed (cognitive 20) REDACTED:1238— prompt_priming._take_primed has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 4, error handling 1, loops 1, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
qwen35_ane_prefill._enable_fused_gdn_banks (cognitive 20) omlx/patches/qwen35_ane_prefill.py:3003— qwen35_ane_prefill._enable_fused_gdn_banks has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 2, error handling 1 (2 pts), loops 2, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
launcher.resolve_target (cognitive 20) omlx/prefill_helper/launcher.py:91— launcher.resolve_target has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (8 pts), error handling 2 (4 pts), ternaries 4, boolean chains 3, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Scheduler._get_stop_tokens (cognitive 20) omlx/scheduler.py:3605— Scheduler._get_stop_tokens has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 3, error handling 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Scheduler._apply_turboquant_kv_empty (cognitive 20) omlx/scheduler.py:4092— Scheduler._apply_turboquant_kv_empty has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (4 pts), ternaries 2 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Scheduler.fail_all_requests (cognitive 20) omlx/scheduler.py:12637— Scheduler.fail_all_requests has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 7, error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
model_loading._checkpoint_weight_prefix (cognitive 20) omlx/utils/model_loading.py:1258— model_loading._checkpoint_weight_prefix has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (9 pts), error handling 3 (5 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
build._strip_unused_packages (cognitive 20) REDACTED:980— build._strip_unused_packages has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 4, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
repack_ternary_t5.repack_shard (cognitive 20) scripts/repack_ternary_t5.py:210— repack_ternary_t5.repack_shard has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelCardSheet.metadataRow (cognitive 20) apps/omlx-mac/Sources/AppView/Screens/ModelCardSheet.swift:251— ModelCardSheet.metadataRow has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 9 (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.
IntegrationsScreenVM.load (cognitive 20) apps/omlx-mac/Sources/AppView/ViewModels/IntegrationsScreenVM.swift:186— IntegrationsScreenVM.load has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 2, error handling 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MenubarStatsPoller.refreshOnce (cognitive 20) apps/omlx-mac/Sources/Menubar/MenubarStatsPoller.swift:322— MenubarStatsPoller.refreshOnce has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (14 pts), error handling 2 (4 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.
clusterV2Wizard.previewMembershipExpansion (cognitive 20) apps/omlx-web/omlx_web/static/js/cluster_v2.js:3517— clusterV2Wizard.previewMembershipExpansion has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 15, if/else 3, error handling 1, ternaries 1. Of this number, 16 points are the body's own statements and 4 belong to 6 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
dashboard.loadGlobalSettings (cognitive 20) REDACTED:1284— dashboard.loadGlobalSettings has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 4 (8 pts), boolean chains 3, error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dashboard.applyProfileToForm (cognitive 20) REDACTED:2497— dashboard.applyProfileToForm has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 5, error handling 2 (3 pts), ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hf_uploader._storage_summary (cognitive 19) omlx/admin/hf_uploader.py:182— hf_uploader._storage_summary has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OQManager._estimate_progress (cognitive 19) omlx/admin/oq_manager.py:738— OQManager._estimate_progress has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (15 pts), boolean chains 2, 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.
ToolCallStreamFilter._could_be_partial_attr_function_open (cognitive 19) omlx/api/tool_calling.py:3258— ToolCallStreamFilter._could_be_partial_attr_function_open has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 3, loops 1, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
discovery._default_interface_lister (cognitive 19) REDACTED:851— discovery._default_interface_lister has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 1 (3 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
inference_worker._think_token_ids (cognitive 19) omlx/cluster/inference_worker.py:258— inference_worker._think_token_ids has cognitive complexity 19 (threshold 15). Drivers by points: error handling 4 (6 pts), if/else 5 (6 pts), boolean chains 5, ternaries 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DistributedJobSupervisor._reap_remote_ranks (cognitive 19) omlx/cluster/launch.py:3215— DistributedJobSupervisor._reap_remote_ranks has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (9 pts), error handling 2 (5 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
launch.run_cluster_performance_probe (cognitive 19) omlx/cluster/launch.py:1414— launch.run_cluster_performance_probe has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (7 pts), boolean chains 4, error handling 3 (4 pts), ternaries 2 (3 pts), loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
prefill_guard.rank_monitor (cognitive 19) omlx/cluster/prefill_guard.py:37— prefill_guard.rank_monitor has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 9, if/else 4 (6 pts), ternaries 2, error handling 1, loops 1 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
DistributedBatchedEngine._backend_chat_messages (cognitive 19) omlx/engine/distributed.py:813— DistributedBatchedEngine._backend_chat_messages has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (15 pts), loops 2 (4 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.
SplashEngine._stream (cognitive 19) REDACTED:1513— SplashEngine._stream has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 6, loops 2 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
splash._check_model (cognitive 19) REDACTED:593— splash._check_model has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 5 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
sts._detect_sts_family (cognitive 19) omlx/engine/sts.py:54— sts._detect_sts_family has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
VLMBatchedEngine._encode_missing_vision_features (cognitive 19) omlx/engine/vlm.py:3588— VLMBatchedEngine._encode_missing_vision_features has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 5, loops 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.
humaneval._extract_code (cognitive 19) omlx/eval/humaneval.py:59— humaneval._extract_code has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClaudeCodeIntegration.launch (cognitive 19) omlx/integrations/claude.py:86— ClaudeCodeIntegration.launch has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 5 (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.
ModelSettingsManager.update_profile (cognitive 19) omlx/model_settings.py:1543— ModelSettingsManager.update_profile has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 4, 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.
_LazyTensorIndex._classify_pair (cognitive 19) omlx/oq.py:5585— _LazyTensorIndex._classify_pair has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 8 (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.
Compressor.consume (cognitive 19) omlx/patches/deepseek_v4/deepseek_v4_model.py:1081— Compressor.consume has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (12 pts), ternaries 2 (5 pts), boolean chains 2 (nesting depth added 6). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
DeepseekV32Attention.__call__ (cognitive 19) omlx/patches/glm_moe_dsa/deepseek_v32.py:493— DeepseekV32Attention.__call__ has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 1, ternaries 1 (nesting depth added 5). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
ane_prefill._projection_part (cognitive 19) omlx/patches/k2_horizon/ane_prefill.py:97— ane_prefill._projection_part has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 5 (11 pts), if/else 5 (8 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
m5_gather_qmm.fused_gate_up_activation (cognitive 19) omlx/patches/m5_gather_qmm.py:245— m5_gather_qmm.fused_gate_up_activation has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 5 (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.
MiMoV2Model.__call__ (cognitive 19) omlx/patches/mimo_v2/mimo_v2_model.py:425— MiMoV2Model.__call__ has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (12 pts), ternaries 5 (6 pts), loops 1 (nesting depth added 3). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
pipeline_patch._pipelined_call (cognitive 19) omlx/patches/minimax_m3_mlx_lm/pipeline_patch.py:154— pipeline_patch._pipelined_call has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (11 pts), ternaries 3 (4 pts), boolean chains 3, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
ContextCopy.propose (cognitive 19) omlx/patches/mlx_lm_mtp/context_copy.py:114— ContextCopy.propose has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 3, loops 2 (3 pts), ternaries 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.
prompt_priming._cache_at_offset (cognitive 19) REDACTED:348— prompt_priming._cache_at_offset has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 3, loops 1, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
prompt_priming._capture_boundary_candidate (cognitive 19) REDACTED:742— prompt_priming._capture_boundary_candidate has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 7, 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.
decode_kernels.mla_head_qmv (cognitive 19) omlx/patches/mlx_vlm_glm5_next_compat/decode_kernels.py:3452— decode_kernels.mla_head_qmv has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 9 (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.
ExpertCache._ensure_ids (cognitive 19) omlx/patches/moe_expert_offload.py:520— ExpertCache._ensure_ids has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 3, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
qwen35_ane_prefill._prepare_gdn_for_bank (cognitive 19) omlx/patches/qwen35_ane_prefill.py:1364— qwen35_ane_prefill._prepare_gdn_for_bank has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 4, ternaries 3 (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.
qwen35_ane_prefill.release_qwen35_ane_prefill (cognitive 19) omlx/patches/qwen35_ane_prefill.py:3550— qwen35_ane_prefill.release_qwen35_ane_prefill has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 4 (7 pts), boolean chains 1, ternaries 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DeepseekV41Adapter.apply_state (cognitive 19) omlx/prefill_helper/adapters/deepseek_v41.py:247— DeepseekV41Adapter.apply_state has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 2 (8 pts), if/else 3 (7 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Scheduler._predicted_chunk_transient (cognitive 19) omlx/scheduler.py:4970— Scheduler._predicted_chunk_transient has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Scheduler._infer_live_layer_cache_types (cognitive 19) omlx/scheduler.py:16662— Scheduler._infer_live_layer_cache_types has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 5, error handling 4, loops 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.
server._with_prompt_progress (cognitive 19) REDACTED:2968— server._with_prompt_progress has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 5, loops 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GlobalSettings.ensure_directories (cognitive 19) omlx/settings.py:1628— GlobalSettings.ensure_directories has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), error handling 3 (7 pts), loops 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
settings.get_auto_ssd_cache_size (cognitive 19) omlx/settings.py:133— settings.get_auto_ssd_cache_size has cognitive complexity 19 (threshold 15). Drivers by points: loops 4 (7 pts), if/else 2 (6 pts), error handling 1 (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.
nax_attention.nax_mixed_head_dim_attention (cognitive 19) omlx/utils/nax_attention.py:970— nax_attention.nax_mixed_head_dim_attention has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 6, error handling 1 (2 pts) (nesting depth added 4). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
AppServices.applyStorageChanges (cognitive 19) apps/omlx-mac/Sources/AppView/AppServices.swift:195— AppServices.applyStorageChanges has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 5 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
dashboard.dashboard.sortModels (cognitive 19) REDACTED:8726— dashboard.dashboard.sortModels has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 12, if/else 6, ternaries 1. Most of this is not in the body itself: 1 of the 19 points is its own statement and the rest belongs to one function literal inside it that branches (line 8729). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
dashboard.applyPresetToForm (cognitive 19) REDACTED:2384— dashboard.applyPresetToForm has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 4, ternaries 1 (3 pts), loops 1, other 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.
routes._apply_cache_settings_runtime (cognitive 18) omlx/admin/routes.py:1477— routes._apply_cache_settings_runtime has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (7 pts), ternaries 2 (6 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
routes._vlm_mtp_recipe_problem (cognitive 18) omlx/admin/routes.py:3960— routes._vlm_mtp_recipe_problem has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 6, ternaries 1 (2 pts), error handling 1, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
routes._load_fallback_commits (cognitive 18) omlx/admin/routes.py:6411— routes._load_fallback_commits has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), error handling 2 (4 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Affine4KVCache.attention (cognitive 18) omlx/affine4.py:1326— Affine4KVCache.attention has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 5 (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.
anthropic_utils.request_has_cache_control (cognitive 18) omlx/api/anthropic_utils.py:32— anthropic_utils.request_has_cache_control has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 4 (6 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.
anthropic_utils._extract_tool_result_content (cognitive 18) omlx/api/anthropic_utils.py:835— anthropic_utils._extract_tool_result_content has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 1 (2 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tool_calling._repair_json_value (cognitive 18) omlx/api/tool_calling.py:261— tool_calling._repair_json_value has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 1 (3 pts), loops 2, 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.
BlockAwarePrefixCache._gdn_split_layout_supported (cognitive 18) omlx/cache/prefix_cache.py:408— BlockAwarePrefixCache._gdn_split_layout_supported has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 4, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BlockAwarePrefixCache._validated_gdn_snapshot_layers (cognitive 18) omlx/cache/prefix_cache.py:449— BlockAwarePrefixCache._validated_gdn_snapshot_layers has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 3, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BlockAwarePrefixCache._detect_window_padding_from_blocks (cognitive 18) omlx/cache/prefix_cache.py:748— BlockAwarePrefixCache._detect_window_padding_from_blocks has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 5, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BlockAwarePrefixCache._strip_rotating_payload (cognitive 18) omlx/cache/prefix_cache.py:2197— BlockAwarePrefixCache._strip_rotating_payload has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 7, if/else 6 (7 pts), ternaries 1 (2 pts), error handling 1, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
BlockAwarePrefixCache._tq_block_params (cognitive 18) omlx/cache/prefix_cache.py:5076— BlockAwarePrefixCache._tq_block_params has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 4, error handling 1 (3 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DiscoveryService._sync_interfaces (cognitive 18) REDACTED:1504— DiscoveryService._sync_interfaces has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), error handling 4 (7 pts), loops 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
inference_worker.main (cognitive 18) omlx/cluster/inference_worker.py:1802— inference_worker.main has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 4, loops 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.
ModelLayout.__post_init__ (cognitive 18) omlx/cluster/planner.py:130— ModelLayout.__post_init__ has cognitive complexity 18 (threshold 15). Drivers by points: if/else 15, boolean chains 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.
planner._kv_bytes_per_token_per_layer (cognitive 18) omlx/cluster/planner.py:1017— planner._kv_bytes_per_token_per_layer has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 5, ternaries 2 (4 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DeviceRegistry.mark_paired (cognitive 18) omlx/cluster/registry.py:483— DeviceRegistry.mark_paired has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 10, if/else 4, ternaries 3, error handling 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ssh_keys.generate_ssh_key_pair (cognitive 18) omlx/cluster/ssh_keys.py:107— ssh_keys.generate_ssh_key_pair has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tensor_strategies._shard_nemotron_h (cognitive 18) omlx/cluster/tensor_strategies.py:496— tensor_strategies._shard_nemotron_h has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tensor_strategies._shard_glm5_next (cognitive 18) omlx/cluster/tensor_strategies.py:684— tensor_strategies._shard_glm5_next has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 3 (7 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BaseEngine._system_prefix_ids (cognitive 18) omlx/engine/base.py:326— BaseEngine._system_prefix_ids has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3, error handling 1, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EnginePool.moe_offload_fit (cognitive 18) omlx/engine_pool.py:771— EnginePool.moe_offload_fit has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 7 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
EnginePool.discover_models (cognitive 18) omlx/engine_pool.py:1528— EnginePool.discover_models has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 4, loops 3 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelSettingsManager.update_template (cognitive 18) omlx/model_settings.py:1894— ModelSettingsManager.update_template has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 2 (5 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
model_settings.validate_ane_prefill (cognitive 18) omlx/model_settings.py:98— model_settings.validate_ane_prefill has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 4, ternaries 3 (4 pts), loops 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
openjev.render_prompt (cognitive 18) omlx/models/openjev.py:124— openjev.render_prompt has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 6 (10 pts), if/else 4 (7 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
oq._block_dequant_fp8 (cognitive 18) omlx/oq.py:3112— oq._block_dequant_fp8 has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 6 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
oq._calibration_resident_checkpoint_bytes (cognitive 18) omlx/oq.py:4354— oq._calibration_resident_checkpoint_bytes has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), error handling 2 (5 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
oq._load_or_collect_imatrix (cognitive 18) omlx/oq.py:11045— oq._load_or_collect_imatrix has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 5, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LinearAttention.__call__ (cognitive 18) omlx/patches/bailing_hybrid/bailing_hybrid_model.py:500— LinearAttention.__call__ has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 1 (2 pts), boolean chains 1, ternaries 1 (nesting depth added 6). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
Model.mtp_partial_rollback (cognitive 18) omlx/patches/bailing_hybrid/bailing_hybrid_model.py:849— Model.mtp_partial_rollback has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 4 (5 pts), boolean chains 2 (nesting depth added 6). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
deepseek_v4_model._materialize_cache_arrays (cognitive 18) omlx/patches/deepseek_v4/deepseek_v4_model.py:191— deepseek_v4_model._materialize_cache_arrays has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 9). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
moe_offload.resolve_view (cognitive 18) omlx/patches/deepseek_v4/moe_offload.py:82— moe_offload.resolve_view has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
m5_gather_qmm_a8._supports_mx (cognitive 18) omlx/patches/m5_gather_qmm_a8.py:1040— m5_gather_qmm_a8._supports_mx has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 8, if/else 8, ternaries 2. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
m5_gather_qmm_nax._launch (cognitive 18) omlx/patches/m5_gather_qmm_nax.py:1383— m5_gather_qmm_nax._launch has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (9 pts), ternaries 6 (7 pts), boolean chains 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
audio.audio_cache_key_ranges (cognitive 18) omlx/patches/mimo_v2/audio.py:17— audio.audio_cache_key_ranges has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
decode_fast._attention (cognitive 18) omlx/patches/mimo_v2/decode_fast.py:875— decode_fast._attention has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
batch_generator._reconcile_mtp_batch_to_standard (cognitive 18) REDACTED:1476— batch_generator._reconcile_mtp_batch_to_standard has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 2, error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
glm_moe_dsa_model._infer_mtp_quant_overrides (cognitive 18) omlx/patches/mlx_lm_mtp/glm_moe_dsa_model.py:137— glm_moe_dsa_model._infer_mtp_quant_overrides has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 4, ternaries 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mlx_vlm_minimax_m3_compat._normalize_quantization_config (cognitive 18) omlx/patches/mlx_vlm_minimax_m3_compat/__init__.py:308— mlx_vlm_minimax_m3_compat._normalize_quantization_config has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), loops 2 (5 pts), boolean chains 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
sdpa256_attention._array_tiled_sdpa256 (cognitive 18) omlx/patches/sdpa256_attention.py:101— sdpa256_attention._array_tiled_sdpa256 has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (3 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
turboquant_attention.apply_turboquant_attention_patch (cognitive 18) omlx/patches/turboquant_attention.py:947— turboquant_attention.apply_turboquant_attention_patch has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), error handling 4, boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Scheduler._align_block_size_with_rotating_window (cognitive 18) omlx/scheduler.py:3275— Scheduler._align_block_size_with_rotating_window has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 4 (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.
Scheduler._model_uses_mla (cognitive 18) omlx/scheduler.py:3880— Scheduler._model_uses_mla has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 3, loops 2 (3 pts), error handling 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProfilesTab.detailCard (cognitive 18) apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:728— ProfilesTab.detailCard has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 4 (9 pts), if/else 4 (5 pts), boolean chains 2, match/switch 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.
AskAIConversation.streamRound (cognitive 18) apps/omlx-mac/Sources/AskAI/AskAIConversation.swift:162— AskAIConversation.streamRound has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 1 (3 pts), loops 1 (2 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.
TalkAIController.captionLines (cognitive 18) apps/omlx-mac/Sources/AskAI/TalkAIController.swift:708— TalkAIController.captionLines has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 8, if/else 3 (6 pts), loops 2 (3 pts), ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dashboard.dashboard.applyProfileToForm (cognitive 18) REDACTED:2497— dashboard.dashboard.applyProfileToForm has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 5, error handling 1, ternaries 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dashboard.matchedPreset (cognitive 18) REDACTED:1835— dashboard.matchedPreset has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 6, loops 2 (3 pts) (nesting depth added 4). Of this number, 14 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dashboard.createProfile (cognitive 18) REDACTED:2447— dashboard.createProfile has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 5, error handling 2 (3 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
dashboard.searchHFModels (cognitive 18) REDACTED:8802— dashboard.searchHFModels has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (13 pts), error handling 2 (3 pts), boolean chains 2 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
HarmonyStreamingParser.process_token (cognitive 17) omlx/adapter/harmony.py:273— HarmonyStreamingParser.process_token has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 4, error handling 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hf_downloader._resolve_endpoint (cognitive 17) REDACTED:149— hf_downloader._resolve_endpoint has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 1 (3 pts), error handling 2, boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hf_uploader._generate_model_card (cognitive 17) omlx/admin/hf_uploader.py:226— hf_uploader._generate_model_card has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8, boolean chains 4, ternaries 3, loops 2. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
model_recommender.build_sections (cognitive 17) omlx/admin/model_recommender.py:368— model_recommender.build_sections has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 5 (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.
ms_downloader._enrich_ms_entry (cognitive 17) omlx/admin/ms_downloader.py:262— ms_downloader._enrich_ms_entry has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 7, ternaries 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
routes._apply_model_dirs_runtime (cognitive 17) omlx/admin/routes.py:1302— routes._apply_model_dirs_runtime has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (11 pts), error handling 2 (3 pts), loops 2, ternaries 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
tool_calling._parse_attribute_function_tool_calls (cognitive 17) omlx/api/tool_calling.py:1097— tool_calling._parse_attribute_function_tool_calls has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 3 (4 pts), ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PagedSSDCacheManager.commit_gdn_checkpoint_file (cognitive 17) omlx/cache/paged_ssd_cache.py:2606— PagedSSDCacheManager.commit_gdn_checkpoint_file has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 6, error handling 3 (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.
PagedSSDCacheManager._is_compatible_block (cognitive 17) omlx/cache/paged_ssd_cache.py:2834— PagedSSDCacheManager._is_compatible_block has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (15 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.
PagedSSDCacheManager._evict_tracked_until_size (cognitive 17) omlx/cache/paged_ssd_cache.py:5039— PagedSSDCacheManager._evict_tracked_until_size has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PagedSSDCacheManager.shrink_hot_cache_to (cognitive 17) omlx/cache/paged_ssd_cache.py:5260— PagedSSDCacheManager.shrink_hot_cache_to has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
paged_ssd_cache._store_nstate_elements_flat (cognitive 17) omlx/cache/paged_ssd_cache.py:765— paged_ssd_cache._store_nstate_elements_flat has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), ternaries 2 (6 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CacheListHandler.reconstruct_cache (cognitive 17) omlx/cache/type_handlers.py:1092— CacheListHandler.reconstruct_cache has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), error handling 3 (4 pts), boolean chains 2, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Qwen4QSAKVCacheHandler.concatenate_states (cognitive 17) omlx/cache/type_handlers.py:1743— Qwen4QSAKVCacheHandler.concatenate_states has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 3 (4 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.main (cognitive 17) REDACTED:1113— cli.main has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
collective.run_local_collective_smoke (cognitive 17) omlx/cluster/collective.py:104— collective.run_local_collective_smoke has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 2 (4 pts), boolean chains 2, error handling 2, loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DiscoveryService._handle_hello (cognitive 17) REDACTED:1709— DiscoveryService._handle_hello has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 3 (5 pts), error handling 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
model_inventory.engine_pool_model_inventory (cognitive 17) omlx/cluster/model_inventory.py:92— model_inventory.engine_pool_model_inventory has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 7, loops 1, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PairingManager.unpair (cognitive 17) REDACTED:1612— PairingManager.unpair has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, if/else 6 (7 pts), error handling 1 (2 pts) (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ExecutionSettings.__post_init__ (cognitive 17) omlx/cluster/performance.py:182— ExecutionSettings.__post_init__ has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 5, loops 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
DeviceRegistry._validate_paired (cognitive 17) omlx/cluster/registry.py:268— DeviceRegistry._validate_paired has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 4, ternaries 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
RuntimeTelemetry.poll_cancel_requests (cognitive 17) omlx/cluster/telemetry.py:742— RuntimeTelemetry.poll_cancel_requests has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BatchedEngine.model_type (cognitive 17) REDACTED:158— BatchedEngine.model_type has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 3 (9 pts), if/else 5 (7 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.
_WhisperRealtimeBackend._emit_stable_delta (cognitive 17) REDACTED:318— _WhisperRealtimeBackend._emit_stable_delta has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MemoryMonitor.set_model_info (cognitive 17) REDACTED:485— MemoryMonitor.set_model_info has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 6 (8 pts), boolean chains 7, if/else 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
model_discovery._vision_weight_bytes (cognitive 17) omlx/model_discovery.py:1199— model_discovery._vision_weight_bytes has cognitive complexity 17 (threshold 15). Drivers by points: loops 3 (6 pts), error handling 2 (5 pts), if/else 2 (5 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D3Model.encode (cognitive 17) omlx/models/d3.py:523— D3Model.encode has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 6, if/else 3 (5 pts), ternaries 2 (3 pts), error handling 1 (2 pts), loops 1 (nesting depth added 4). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
oq._synthesize_mtp_quant_entries (cognitive 17) omlx/oq.py:2162— oq._synthesize_mtp_quant_entries has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
swiglu_clamp.bind_limits (cognitive 17) omlx/patches/bailing_hybrid/swiglu_clamp.py:98— swiglu_clamp.bind_limits has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (15 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BatchPoolingCache._trim_rows_from_undo (cognitive 17) omlx/patches/deepseek_v4/cache_extras.py:851— BatchPoolingCache._trim_rows_from_undo has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (13 pts), ternaries 2, boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
m5_gather_qmm_nax.sorted_gather_qmm_swiglu (cognitive 17) omlx/patches/m5_gather_qmm_nax.py:1760— m5_gather_qmm_nax.sorted_gather_qmm_swiglu has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 4, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
mlx_audio_ming3._pipelined_sample (cognitive 17) omlx/patches/mlx_audio_ming3.py:597— mlx_audio_ming3._pipelined_sample has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
batch_generator._mtp_common_eligible (cognitive 17) REDACTED:615— batch_generator._mtp_common_eligible has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 5 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
batch_generator._prepare_mtp_batch_state_for_next (cognitive 17) REDACTED:1384— batch_generator._prepare_mtp_batch_state_for_next has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 3 (4 pts), loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mlx_vlm_minimax_m3_compat._build_minimax_messages (cognitive 17) omlx/patches/mlx_vlm_minimax_m3_compat/__init__.py:536— mlx_vlm_minimax_m3_compat._build_minimax_messages has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 2 (8 pts), if/else 5 (7 pts), loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mlx_vlm_minimax_m3_compat._extract_text_from_content (cognitive 17) omlx/patches/mlx_vlm_minimax_m3_compat/__init__.py:617— mlx_vlm_minimax_m3_compat._extract_text_from_content has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 2, loops 1 (2 pts), ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
moe_gate_up_fusion.can_fuse (cognitive 17) omlx/patches/moe_gate_up_fusion.py:74— moe_gate_up_fusion.can_fuse has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 6, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
qwen35_ane_prefill.configure_qwen35_ane_prefill_scheduler (cognitive 17) omlx/patches/qwen35_ane_prefill.py:322— qwen35_ane_prefill.configure_qwen35_ane_prefill_scheduler has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 6, ternaries 1 (2 pts) (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RDA.__call__ (cognitive 17) omlx/patches/raon1_mini/raon1_mini_model.py:1284— RDA.__call__ has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 5 (8 pts), if/else 7, boolean chains 2 (nesting depth added 3). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
DeepseekV41Adapter.run_first (cognitive 17) omlx/prefill_helper/adapters/deepseek_v41.py:172— DeepseekV41Adapter.run_first has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 4 (5 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HelperServer._read (cognitive 17) omlx/prefill_helper/worker.py:136— HelperServer._read has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (14 pts), boolean chains 1, 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.
reasoning_effort.apply_chat_template_with_reasoning_effort_fallback (cognitive 17) omlx/reasoning_effort.py:81— reasoning_effort.apply_chat_template_with_reasoning_effort_fallback has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), error handling 3 (6 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Scheduler._check_post_prefill_memory (cognitive 17) omlx/scheduler.py:6425— Scheduler._check_post_prefill_memory has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), ternaries 2 (6 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Scheduler._plan_prefill_chunk (cognitive 17) omlx/scheduler.py:7090— Scheduler._plan_prefill_chunk has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Scheduler._merge_boundary_with_full_cache (cognitive 17) omlx/scheduler.py:9768— Scheduler._merge_boundary_with_full_cache has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (6 pts), boolean chains 5, ternaries 2 (5 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
scheduler._compact_boundary_snapshot_value (cognitive 17) omlx/scheduler.py:147— scheduler._compact_boundary_snapshot_value has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
vlm_mtp.run_vlm_mtp_decode (cognitive 17) omlx/speculative/vlm_mtp.py:266— vlm_mtp.run_vlm_mtp_decode has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), loops 2 (3 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UsageHistory.flush (cognitive 17) omlx/usage_history.py:242— UsageHistory.flush has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 3, loops 1 (2 pts), error handling 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
model_loading.maybe_load_custom_quantization (cognitive 17) omlx/utils/model_loading.py:1695— model_loading.maybe_load_custom_quantization has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), error handling 2 (3 pts), boolean chains 1, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tokenizer.create_streaming_detokenizer (cognitive 17) omlx/utils/tokenizer.py:477— tokenizer.create_streaming_detokenizer has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), error handling 6 (7 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.
video.expand_video_parts (cognitive 17) omlx/utils/video.py:164— video.expand_video_parts has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (3 pts), ternaries 1 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PerformanceScreenVM.load (cognitive 17) apps/omlx-mac/Sources/AppView/ViewModels/PerformanceScreenVM.swift:165— PerformanceScreenVM.load has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 2 (6 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.
AskAIConversation.send (cognitive 17) apps/omlx-mac/Sources/AskAI/AskAIConversation.swift:118— AskAIConversation.send has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (7 pts), ternaries 2 (4 pts), boolean chains 3, loops 1 (2 pts), error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TurnView.body (cognitive 17) apps/omlx-mac/Sources/AskAI/AskAIPanelView.swift:373— TurnView.body has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 5 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
AppUpdater.run (cognitive 17) apps/omlx-mac/Sources/Updater/AppUpdater.swift:158— AppUpdater.run has cognitive complexity 17 (threshold 15). Drivers by points: error handling 9 (10 pts), if/else 6 (7 pts) (nesting depth added 2). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AppUpdater.downloadDMG (cognitive 17) apps/omlx-mac/Sources/Updater/AppUpdater.swift:269— AppUpdater.downloadDMG has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 1 (3 pts), error handling 1 (2 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.
dashboard.dashboard.loadGlobalSettings (cognitive 17) REDACTED:1284— dashboard.dashboard.loadGlobalSettings has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 2 (5 pts), boolean chains 3, error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dashboard.dashboard.buildCtKwargEntries (cognitive 17) REDACTED:2119— dashboard.dashboard.buildCtKwargEntries has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (6 pts), ternaries 2 (6 pts), boolean chains 4, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dashboard.dashboard.createProfile (cognitive 17) REDACTED:2447— dashboard.dashboard.createProfile has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 6, 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, 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.
dashboard.dashboard.addToAccQueue (cognitive 17) REDACTED:6188— dashboard.dashboard.addToAccQueue has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 4, error handling 2 (3 pts), ternaries 2 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
clusterV2Wizard.pollStagingJob (cognitive 17) apps/omlx-web/omlx_web/static/js/cluster_v2.js:3164— clusterV2Wizard.pollStagingJob has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 5, ternaries 1 (2 pts), error handling 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dashboard.buildCtKwargEntries (cognitive 17) REDACTED:2119— dashboard.buildCtKwargEntries has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (6 pts), ternaries 2 (6 pts), boolean chains 4, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dashboard.cacheObsCumulative (cognitive 17) REDACTED:5036— dashboard.cacheObsCumulative has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, if/else 3 (4 pts), loops 2 (3 pts), ternaries 2 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
dashboard.addToAccQueue (cognitive 17) REDACTED:6188— dashboard.addToAccQueue has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 4, error handling 2 (3 pts), ternaries 2 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
_MuseChannelSplitter._handle_marker (cognitive 16) omlx/adapter/muse_glimmer.py:120— _MuseChannelSplitter._handle_marker has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BailingHybridOutputParserSession.finalize (cognitive 16) omlx/adapter/output_parser.py:290— BailingHybridOutputParserSession.finalize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (2 pts), ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ExternalAPIClient.chat_completion (cognitive 16) omlx/admin/external_api.py:292— ExternalAPIClient.chat_completion has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10, error handling 3, boolean chains 2, ternaries 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
hf_downloader._remove_deleted_files (cognitive 16) REDACTED:840— hf_downloader._remove_deleted_files has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), error handling 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hf_downloader._describe_repo_files (cognitive 16) REDACTED:889— hf_downloader._describe_repo_files has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), boolean chains 4, ternaries 3 (4 pts), loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
model_recommender._fetch_families (cognitive 16) omlx/admin/model_recommender.py:821— model_recommender._fetch_families has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 2, loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
routes._clear_cold_remote_cluster_cache_roots (cognitive 16) omlx/admin/routes.py:169— routes._clear_cold_remote_cluster_cache_roots has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), loops 3 (4 pts), error handling 2 (3 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
routes._mtp_compat_for_model (cognitive 16) omlx/admin/routes.py:1180— routes._mtp_compat_for_model has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 2, error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
routes.get_generation_config (cognitive 16) omlx/admin/routes.py:4427— routes.get_generation_config has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 3, error handling 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
routes._iter_loaded_engine_records (cognitive 16) omlx/admin/routes.py:7364— routes._iter_loaded_engine_records has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), ternaries 3 (6 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Affine4Codec.dequantize_rotated (cognitive 16) omlx/affine4.py:182— Affine4Codec.dequantize_rotated has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 2 (3 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
audio_routes._parse_session_update (cognitive 16) omlx/api/audio_routes.py:899— audio_routes._parse_session_update has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 7, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
audio_routes._realtime_images (cognitive 16) omlx/api/audio_routes.py:966— audio_routes._realtime_images has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 3, error handling 1 (2 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
embedding_utils.count_tokens (cognitive 16) omlx/api/embedding_utils.py:89— embedding_utils.count_tokens has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 1 (4 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
responses_utils._extract_tool_output_text (cognitive 16) omlx/api/responses_utils.py:53— responses_utils._extract_tool_output_text has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
thinking.extract_thinking (cognitive 16) omlx/api/thinking.py:156— thinking.extract_thinking has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 4, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
tool_calling._find_attr_function_span (cognitive 16) omlx/api/tool_calling.py:782— tool_calling._find_attr_function_span has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tool_calling.convert_tools_for_template (cognitive 16) omlx/api/tool_calling.py:3741— tool_calling.convert_tools_for_template has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 1, loops 1, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tool_calling.parse_json_output (cognitive 16) omlx/api/tool_calling.py:3975— tool_calling.parse_json_output has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BoundarySnapshotSSDStore.save (cognitive 16) omlx/cache/boundary_snapshot_store.py:221— BoundarySnapshotSSDStore.save has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 2, error handling 2, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
BoundarySnapshotSSDStore.load (cognitive 16) omlx/cache/boundary_snapshot_store.py:378— BoundarySnapshotSSDStore.load has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), error handling 3 (5 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
RotatingKVCacheHandler.reconstruct_cache (cognitive 16) omlx/cache/type_handlers.py:625— RotatingKVCacheHandler.reconstruct_cache has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 6, ternaries 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
RankControlPlane.broadcast_object (cognitive 16) REDACTED:329— RankControlPlane.broadcast_object has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), ternaries 3 (4 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
deployment.validate_model_path_map (cognitive 16) omlx/cluster/deployment.py:150— deployment.validate_model_path_map has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 3, loops 1, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
deployment._assignment_from_dict (cognitive 16) omlx/cluster/deployment.py:256— deployment._assignment_from_dict has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 1, error handling 1, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
DiscoveryService._send_hello (cognitive 16) REDACTED:1649— DiscoveryService._send_hello has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DiscoveryService._tailscale_sweep (cognitive 16) REDACTED:2019— DiscoveryService._tailscale_sweep has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (3 pts), boolean chains 1, error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
pairing.default_revocation_driver (cognitive 16) REDACTED:677— pairing.default_revocation_driver has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), error handling 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
probe.parse_thunderbolt_ports (cognitive 16) omlx/cluster/probe.py:300— probe.parse_thunderbolt_ports has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), boolean chains 5, loops 2 (3 pts), error handling 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
link_probe.probe_link (cognitive 16) omlx/cluster/rdma/link_probe.py:68— link_probe.probe_link has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 3, boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
routes._create_cluster_plan (cognitive 16) omlx/cluster/routes.py:878— routes._create_cluster_plan has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 5, ternaries 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
routes._resolve_fabric (cognitive 16) omlx/cluster/routes.py:1059— routes._resolve_fabric has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 6, if/else 5, ternaries 5. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
RuntimeTelemetry._sample_snapshot (cognitive 16) omlx/cluster/telemetry.py:888— RuntimeTelemetry._sample_snapshot has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, ternaries 7, if/else 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
transport._interface_ip (cognitive 16) omlx/cluster/transport.py:620— transport._interface_ip has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), error handling 2 (4 pts), boolean chains 2, ternaries 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
transport._authorized_ifconfig (cognitive 16) omlx/cluster/transport.py:761— transport._authorized_ifconfig has cognitive complexity 16 (threshold 15). Drivers by points: error handling 5 (7 pts), if/else 5, boolean chains 3, ternaries 1 (nesting depth added 2). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DistributedBatchedEngine._ensure_available (cognitive 16) omlx/engine/distributed.py:571— DistributedBatchedEngine._ensure_available has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), ternaries 2 (5 pts), boolean chains 4 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DistributedBatchedEngine._transport_failure_error (cognitive 16) omlx/engine/distributed.py:615— DistributedBatchedEngine._transport_failure_error has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 2, loops 1, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DistributedBatchedEngine.chat (cognitive 16) omlx/engine/distributed.py:1196— DistributedBatchedEngine.chat has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (6 pts), error handling 4, boolean chains 3, loops 1 (2 pts), ternaries 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
VLMBatchedEngine.stop (cognitive 16) omlx/engine/vlm.py:2932— VLMBatchedEngine.stop has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), error handling 2 (5 pts), boolean chains 2, loops 1 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
VLMBatchedEngine._inject_tool_calling (cognitive 16) omlx/engine/vlm.py:2995— VLMBatchedEngine._inject_tool_calling has cognitive complexity 16 (threshold 15). Drivers by points: error handling 4 (6 pts), if/else 5 (6 pts), boolean chains 3, ternaries 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EnginePool.register_cluster_model (cognitive 16) omlx/engine_pool.py:1782— EnginePool.register_cluster_model has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 4, error handling 1, loops 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.
model_discovery.model_display_name (cognitive 16) omlx/model_discovery.py:1927— model_discovery.model_display_name has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (6 pts), ternaries 2 (4 pts), error handling 2 (3 pts), boolean chains 2, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelSettings.__post_init__ (cognitive 16) omlx/model_settings.py:595— ModelSettings.__post_init__ has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_TrackedTensor.as_expr (cognitive 16) omlx/oq.py:2869— _TrackedTensor.as_expr has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 2 (4 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
bonsai_t5_load._patched_load_weights (cognitive 16) omlx/patches/bonsai_t5_load.py:106— bonsai_t5_load._patched_load_weights has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
chat_template_v4.apply_chat_template (cognitive 16) omlx/patches/deepseek_v4/chat_template_v4.py:860— chat_template_v4.apply_chat_template has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7, boolean chains 5, ternaries 2 (4 pts) (nesting depth added 2). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
LocalAttention.__call__ (cognitive 16) omlx/patches/deepseek_v4/deepseek_v4_model.py:1721— LocalAttention.__call__ has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 3, ternaries 2 (nesting depth added 3). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
decode_fast._expert_kind (cognitive 16) omlx/patches/mimo_v2/decode_fast.py:702— decode_fast._expert_kind has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 5, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
virtual_qkv.register (cognitive 16) omlx/patches/mimo_v2/virtual_qkv.py:163— virtual_qkv.register has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), loops 3 (4 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
batch_generator._reconcile_mtp_to_standard (cognitive 16) REDACTED:1598— batch_generator._reconcile_mtp_to_standard has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 2 (3 pts), boolean chains 2, error handling 1, loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
batch_generator._record_std_tax_sample (cognitive 16) REDACTED:2538— batch_generator._record_std_tax_sample has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, error handling 3 (4 pts), boolean chains 2, ternaries 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
BatchPolicy.observe_mtp (cognitive 16) omlx/patches/mlx_lm_mtp/batch_policy.py:93— BatchPolicy.observe_mtp has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 3, ternaries 2, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
decode_kernels.multi_qmv (cognitive 16) omlx/patches/mlx_vlm_glm5_next_compat/decode_kernels.py:3577— decode_kernels.multi_qmv has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 3, loops 2, ternaries 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
qwen35_ane_prefill._gdn_backend_exact (cognitive 16) omlx/patches/qwen35_ane_prefill.py:1580— qwen35_ane_prefill._gdn_backend_exact has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (11 pts), error handling 2 (3 pts), boolean chains 2 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
qwen35_oq_a8._classify_uncached (cognitive 16) omlx/patches/qwen35_oq_a8.py:166— qwen35_oq_a8._classify_uncached has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11, boolean chains 5. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
raon1_mini_model._merged_decode (cognitive 16) omlx/patches/raon1_mini/raon1_mini_model.py:901— raon1_mini_model._merged_decode has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 1 (3 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 9). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
PrefillProgressTracker.update (cognitive 16) omlx/prefill_progress.py:33— PrefillProgressTracker.update has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 5, ternaries 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProcessMemoryEnforcer._find_lru_busy_non_pinned_victim_locked (cognitive 16) omlx/process_memory_enforcer.py:1620— ProcessMemoryEnforcer._find_lru_busy_non_pinned_victim_locked has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), error handling 1 (4 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.
Scheduler._guard_prefill_chunk (cognitive 16) omlx/scheduler.py:5204— Scheduler._guard_prefill_chunk has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), ternaries 3 (6 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.
Scheduler._extract_snapshot_cache_states (cognitive 16) omlx/scheduler.py:9182— Scheduler._extract_snapshot_cache_states has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 3, ternaries 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Scheduler._extract_boundary_snapshot (cognitive 16) omlx/scheduler.py:9392— Scheduler._extract_boundary_snapshot has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 1 (2 pts), error handling 1, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Scheduler.get_ssd_cache_stats (cognitive 16) omlx/scheduler.py:17200— Scheduler.get_ssd_cache_stats has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 4 (7 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
server._patch_output_format (cognitive 16) REDACTED:5719— server._patch_output_format has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
generation_config.load_sampling_defaults (cognitive 16) omlx/utils/generation_config.py:111— generation_config.load_sampling_defaults has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 6, if/else 5 (6 pts), loops 2 (4 pts) (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
clone_mlx_model_fp16.clone_model (cognitive 16) scripts/clone_mlx_model_fp16.py:74— clone_mlx_model_fp16.clone_model has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 3, loops 2, ternaries 1 (2 pts) (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
repack_ternary_t5.verify_models (cognitive 16) scripts/repack_ternary_t5.py:368— repack_ternary_t5.verify_models has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AppServices.relocateOrphanPaths (cognitive 16) apps/omlx-mac/Sources/AppView/AppServices.swift:357— AppServices.relocateOrphanPaths has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PrefillAcceleratorGroup.body (cognitive 16) apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1460— PrefillAcceleratorGroup.body has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 3, loops 1, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AccelerationSection.body (cognitive 16) apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2192— AccelerationSection.body has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
ThroughputBenchScreenVM.pendingFeatureFlags (cognitive 16) apps/omlx-mac/Sources/AppView/ViewModels/ThroughputBenchScreenVM.swift:86— ThroughputBenchScreenVM.pendingFeatureFlags has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), ternaries 3 (7 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MenubarController.refreshMenuState (cognitive 16) apps/omlx-mac/Sources/Menubar/MenubarController.swift:382— MenubarController.refreshMenuState has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, boolean chains 6, ternaries 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ReleasesChecker.numberAfterShortMarker (cognitive 16) apps/omlx-mac/Sources/Updater/ReleasesChecker.swift:212— ReleasesChecker.numberAfterShortMarker has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 7, if/else 2 (4 pts), ternaries 2 (4 pts), loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UpdateController.startDownload (cognitive 16) apps/omlx-mac/Sources/Updater/UpdateController.swift:385— UpdateController.startDownload has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 3, match/switch 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.
WelcomeViewModel.startServer (cognitive 16) apps/omlx-mac/Sources/Welcome/WelcomeWindow.swift:257— WelcomeViewModel.startServer has cognitive complexity 16 (threshold 15). Drivers by points: error handling 4 (5 pts), ternaries 3 (5 pts), if/else 4, match/switch 1 (2 pts) (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
cluster_v2.clusterV2Wizard.wizardSteps (cognitive 16) apps/omlx-web/omlx_web/static/js/cluster_v2.js:1110— cluster_v2.clusterV2Wizard.wizardSteps has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 4 (8 pts), boolean chains 7, if/else 1 (nesting depth added 4). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 1147, 1127). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
cluster_v2.clusterV2Wizard.pollStagingJob (cognitive 16) apps/omlx-web/omlx_web/static/js/cluster_v2.js:3164— cluster_v2.clusterV2Wizard.pollStagingJob has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 4, ternaries 1 (2 pts), error handling 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dashboard.dashboard.matchedPreset (cognitive 16) REDACTED:1835— dashboard.dashboard.matchedPreset has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 4). Of this number, 13 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dashboard.dashboard.cacheObsCumulative (cognitive 16) REDACTED:5036— dashboard.dashboard.cacheObsCumulative has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 9, if/else 3 (4 pts), loops 2 (3 pts) (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
dashboard.dashboard.searchHFModels (cognitive 16) REDACTED:8802— dashboard.dashboard.searchHFModels has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 2, 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.
logs.parseLogText (cognitive 16) REDACTED:40— logs.parseLogText has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 5 (9 pts), boolean chains 3, if/else 2 (3 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dashboard.resetGlobalSettingsDefaults (cognitive 16) REDACTED:1226— dashboard.resetGlobalSettingsDefaults has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 3, loops 2 (3 pts), error handling 1, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dashboard.startANETuning (cognitive 16) REDACTED:2801— dashboard.startANETuning has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 10, if/else 4, error handling 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
dashboard.pollANETuning (cognitive 16) REDACTED:2859— dashboard.pollANETuning has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 6, error handling 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
dashboard.sortedManagerModels (cognitive 16) REDACTED:7311— dashboard.sortedManagerModels has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 6, ternaries 4 (6 pts), if/else 3, match/switch 1 (nesting depth added 2). None of this is in the body itself: all 16 points belong to one function literal inside it that branches (line 7313). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
Change-coupling hub: REDACTED → ModelSettingsScreen.swift, PerformanceScreen.swift, ModelSettingsScreenVM.swift, GlobalSettingsDTO.swift, ModelsDTO.swift, OMLXClient.swift, accuracy_benchmark.py, routes.py, config.py, settings.py REDACTED— `REDACTED` changes together with 10 other files — `apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift`, `apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift`, `apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift`, `apps/omlx-mac/Sources/Net/DTO/GlobalSettingsDTO.swift`, `apps/omlx-mac/Sources/Net/DTO/ModelsDTO.swift`, `apps/omlx-mac/Sources/Net/OMLXClient.swift`, `omlx/admin/accuracy_benchmark.py`, `omlx/admin/routes.py`, `omlx/config.py`, `omlx/settings.py` — none of which declares a dependency on it: one file is the hub of 10 separate couplings, not 10 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 10.
D4 · Code Duplication· Near-duplicate member family (3 members, 18 shared lines) · ×1
Near-duplicate member family (3 members, 18 shared lines) apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:73— apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:73-103 | apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:113-137 | apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:141-162 — These 3 members are variants of one another: a block of 18 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 3 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 3 times.
Near-duplicate member pair (217 shared lines) REDACTED:290— REDACTED:290-843 | omlx/engine/vlm.py:1983-2851 — These two members are variants of one another: 217 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (91 shared lines) omlx/patches/deepseek_v4/chat_template_v4.py:298— omlx/patches/deepseek_v4/chat_template_v4.py:298-491 | omlx/patches/deepseek_v41/encoding.py:584-734 — These two members are variants of one another: 91 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (78 shared lines) omlx/patches/qwen35_ane_prefill.py:1113— omlx/patches/qwen35_ane_prefill.py:1113-1271 | omlx/patches/qwen35_ane_prefill.py:1367-1485 — These two members are variants of one another: 78 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (73 shared lines) apps/omlx-mac/Sources/AppView/Screens/ContextBenchScreen.swift:98— apps/omlx-mac/Sources/AppView/Screens/ContextBenchScreen.swift:98-202 | apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift:177-331 — These two members are variants of one another: 73 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (63 shared lines) omlx/patches/deepseek_v4/moe_offload.py:160— omlx/patches/deepseek_v4/moe_offload.py:160-233 | omlx/patches/glm_moe_dsa/moe_offload.py:199-283 — These two members are variants of one another: 63 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (46 shared lines) omlx/patches/glm_moe_dsa/deepseek_v32.py:499— omlx/patches/glm_moe_dsa/deepseek_v32.py:499-575 | omlx/patches/glm_moe_dsa/glm_moe_dsa_model.py:192-411 — These two members are variants of one another: 46 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (27 shared lines) omlx/patches/deepseek_v4/deepseek_v4_model.py:1729— omlx/patches/deepseek_v4/deepseek_v4_model.py:1729-1783 | omlx/patches/deepseek_v4/deepseek_v4_model.py:1841-1954 — These two members are variants of one another: 27 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication· Edited copy of a member (35 corresponding lines) · ×1
Edited copy of a member (35 corresponding lines) apps/omlx-mac/Sources/AppView/Screens/NetworkScreen.swift:23— apps/omlx-mac/Sources/AppView/Screens/NetworkScreen.swift:23-60 | apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift:24-62 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Members sharing a duplicated core (10 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (10 members, 50+ identical tokens) apps/omlx-mac/Sources/AppView/Screens/IntegrationsScreen.swift:45— apps/omlx-mac/Sources/AppView/Screens/IntegrationsScreen.swift:45-213 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1091-1206 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2192-2414 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2494-2853 | apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift:70-136 | apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift:145-249 | apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:17-237 | apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:492-620 | apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:699-791 | apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift:177-331 — These 10 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 10 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 10 times.
Duplicated block (100 lines × 2) omlx/patches/mlx_vlm_mtp/qwen35_moe_vlm_runtime.py:268— omlx/patches/mlx_vlm_mtp/qwen35_moe_vlm_runtime.py:268-367 | omlx/patches/mlx_vlm_mtp/qwen35_vlm_runtime.py:334-433 — before extracting anything, compare `omlx/patches/mlx_vlm_mtp/qwen35_moe_vlm_runtime.py` and `omlx/patches/mlx_vlm_mtp/qwen35_vlm_runtime.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 282 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 `omlx/patches/mlx_vlm_mtp/qwen35_moe_vlm_runtime.py:268` 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 (92 lines × 2) REDACTED:587— REDACTED:587-678 | omlx/engine/vlm.py:2300-2391 — before extracting anything, compare `REDACTED` and `omlx/engine/vlm.py` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 469 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 (63–66 lines × 2) omlx/engine/distributed.py:1369— omlx/engine/distributed.py:1369-1434 | omlx/engine/distributed.py:1700-1762 — both copies are in the same file, so extract the 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 `omlx/engine/distributed.py:1369` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (55–65 lines × 2) omlx/patches/mlx_vlm_mtp/qwen35_moe_vlm_runtime.py:376— omlx/patches/mlx_vlm_mtp/qwen35_moe_vlm_runtime.py:376-440 | omlx/patches/mlx_vlm_mtp/qwen35_vlm_runtime.py:495-549 — before extracting anything, compare `omlx/patches/mlx_vlm_mtp/qwen35_moe_vlm_runtime.py` and `omlx/patches/mlx_vlm_mtp/qwen35_vlm_runtime.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 282 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 (37–60 lines × 2) omlx/patches/deepseek_v4/chat_template_v4.py:628— omlx/patches/deepseek_v4/chat_template_v4.py:628-687 | omlx/patches/deepseek_v41/encoding.py:770-806 — before extracting anything, compare `omlx/patches/deepseek_v4/chat_template_v4.py` and `omlx/patches/deepseek_v41/encoding.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 210 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 (55–60 lines × 2) omlx/patches/deepseek_v4/deepseek_v4_model.py:2420— omlx/patches/deepseek_v4/deepseek_v4_model.py:2420-2474 | omlx/patches/mlx_lm_mtp/deepseek_v4_model.py:720-779 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `weights` to `Dict[str, mx.array]` in one and `Dict[str, Any]` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (58 lines × 2) REDACTED:1397— REDACTED:1397-1454 | REDACTED:1564-1621 — both copies are in the same file, so extract the 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 (55 lines × 2) omlx/api/markitdown.py:298— omlx/api/markitdown.py:298-352 | omlx/api/markitdown.py:382-436 — both copies are in the same file, so extract the 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 (45–54 lines × 2) REDACTED:1322— REDACTED:1322-1375 | omlx/engine/vlm.py:5062-5106 — before extracting anything, compare `REDACTED` and `omlx/engine/vlm.py` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1322` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (43–49 lines × 2) omlx/patches/mlx_vlm_mtp/qwen35_moe_vlm_runtime.py:219— omlx/patches/mlx_vlm_mtp/qwen35_moe_vlm_runtime.py:219-267 | omlx/patches/mlx_vlm_mtp/qwen35_vlm_runtime.py:285-327 — before extracting anything, compare `omlx/patches/mlx_vlm_mtp/qwen35_moe_vlm_runtime.py` and `omlx/patches/mlx_vlm_mtp/qwen35_vlm_runtime.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 282 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (45–46 lines × 2) omlx/engine/distributed.py:693— omlx/engine/distributed.py:693-738 | omlx/engine/distributed.py:766-810 — both copies are in the same file, so extract the 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 (42–46 lines × 2) omlx/patches/deepseek_v4/chat_template_v4.py:367— omlx/patches/deepseek_v4/chat_template_v4.py:367-412 | omlx/patches/deepseek_v41/encoding.py:623-664 — before extracting anything, compare `omlx/patches/deepseek_v4/chat_template_v4.py` and `omlx/patches/deepseek_v41/encoding.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 210 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `omlx/patches/deepseek_v4/chat_template_v4.py:367` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (43–45 lines × 3) omlx/admin/routes.py:8931— omlx/admin/routes.py:8931-8975 | omlx/admin/routes.py:9247-9289 | omlx/admin/routes.py:9495-9537 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (43 lines × 2) omlx/engine/distributed.py:1241— omlx/engine/distributed.py:1241-1283 | omlx/engine/distributed.py:1601-1643 — both copies are in the same file, so extract the 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 `omlx/engine/distributed.py:1241` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `omlx/engine/distributed.py:1240` calls `pop` and `omlx/engine/distributed.py:1600` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (27–43 lines × 2) omlx/scheduler.py:15144— omlx/scheduler.py:15144-15186 | omlx/scheduler.py:15256-15282 — both copies are in the same file, so extract the 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 `omlx/scheduler.py:15144` 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–42 lines × 2) omlx/cluster/collective.py:201— omlx/cluster/collective.py:201-240 | omlx/cluster/collective.py:292-333 — both copies are in the same file, so extract the 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 `omlx/cluster/collective.py:201` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (40–41 lines × 2) REDACTED:9223— REDACTED:9223-9262 | REDACTED:9318-9358 — both copies are in the same file, so extract the 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 (35–39 lines × 2) omlx/engine/distributed.py:1508— omlx/engine/distributed.py:1508-1542 | omlx/engine/distributed.py:1783-1821 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13–39 lines × 2) omlx/engine_pool.py:3490— omlx/engine_pool.py:3490-3528 | omlx/engine_pool.py:3560-3572 — both copies are in the same file, so extract the 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 `omlx/engine_pool.py:3490` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (38 lines × 2) omlx/patches/deepseek_v4/moe_offload.py:179— omlx/patches/deepseek_v4/moe_offload.py:179-216 | omlx/patches/glm_moe_dsa/moe_offload.py:226-263 — `omlx/patches/deepseek_v4/moe_offload.py` and `omlx/patches/glm_moe_dsa/moe_offload.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 10 separate duplicated blocks between them, totalling at least 144 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (29–37 lines × 2) omlx/cluster/launch.py:1468— omlx/cluster/launch.py:1468-1496 | omlx/cluster/launch.py:1600-1636 — both copies are in the same file, so extract the 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 (32–37 lines × 2) omlx/engine/tts.py:336— omlx/engine/tts.py:336-372 | omlx/engine/tts.py:466-497 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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 (34–36 lines × 3) omlx/cluster/collective.py:110— omlx/cluster/collective.py:110-144 | omlx/cluster/collective.py:194-227 | omlx/cluster/collective.py:285-320 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (25–36 lines × 3) REDACTED:4707— REDACTED:4707-4732 | REDACTED:5199-5234 | REDACTED:6108-6132 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:6104` calls `prompt_opens_thinking`, `getattr` and `REDACTED:4705` 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 (30–36 lines × 2) REDACTED:370— REDACTED:370-399 | omlx/engine/vlm.py:2155-2190 — before extracting anything, compare `REDACTED` and `omlx/engine/vlm.py` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:370` 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 (35–36 lines × 2) REDACTED:8183— REDACTED:8183-8218 | REDACTED:8950-8984 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:8183` 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 (32–35 lines × 2) REDACTED:4358— REDACTED:4358-4392 | REDACTED:4474-4505 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:4358` 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `request` to `SystemOneRequest` in one and `DecisionRequest` 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 (30–34 lines × 2) omlx/patches/qwen35_ane_prefill.py:2241— omlx/patches/qwen35_ane_prefill.py:2241-2274 | omlx/patches/qwen35_ane_prefill.py:2346-2375 — both copies are in the same file, so extract the 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 `omlx/patches/qwen35_ane_prefill.py:2241` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (32–34 lines × 2) REDACTED:737— REDACTED:737-770 | REDACTED:778-809 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (20–33 lines × 2) omlx/oq.py:10918— omlx/oq.py:10918-10937 | omlx/oq.py:11319-11351 — both copies are in the same file, so extract the 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 (32 lines × 3) omlx/patches/mlx_lm_mtp/qwen35_model.py:184— omlx/patches/mlx_lm_mtp/qwen35_model.py:184-215 | omlx/patches/mlx_vlm_mtp/qwen35_moe_vlm_runtime.py:157-188 | omlx/patches/mlx_vlm_mtp/qwen35_vlm_runtime.py:218-249 — 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 (31–32 lines × 2) REDACTED:689— REDACTED:689-719 | omlx/engine/vlm.py:2733-2764 — before extracting anything, compare `REDACTED` and `omlx/engine/vlm.py` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (30–32 lines × 2) omlx/scheduler.py:3762— omlx/scheduler.py:3762-3793 | omlx/scheduler.py:8466-8495 — both copies are in the same file, so extract the 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 `omlx/scheduler.py:3762` 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–31 lines × 2) REDACTED:1919— REDACTED:1919-1949 | omlx/admin/ms_downloader.py:839-861 — 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 `REDACTED:1919` 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 (30–31 lines × 2) omlx/patches/deepseek_v4/deepseek_v4_model.py:2478— omlx/patches/deepseek_v4/deepseek_v4_model.py:2478-2507 | omlx/patches/mlx_lm_mtp/deepseek_v4_model.py:805-835 — 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 (28–30 lines × 2) omlx/oq.py:10963— omlx/oq.py:10963-10992 | omlx/oq.py:11368-11395 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16–29 lines × 3) omlx/oq.py:10922— omlx/oq.py:10922-10937 | omlx/oq.py:11323-11351 | omlx/oq.py:11805-11824 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `omlx/oq.py:10922` 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, `omlx/oq.py:11803` calls `import` and `omlx/oq.py:10921` 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 (24–29 lines × 2) omlx/cache/boundary_snapshot_store.py:1792— omlx/cache/boundary_snapshot_store.py:1792-1820 | omlx/cache/boundary_snapshot_store.py:1954-1977 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (25–29 lines × 2) omlx/eval/livecodebench.py:36— omlx/eval/livecodebench.py:36-64 | omlx/eval/mbpp.py:32-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. 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–28 lines × 2) omlx/patches/deepseek_v4/chat_template_v4.py:572— omlx/patches/deepseek_v4/chat_template_v4.py:572-599 | omlx/patches/deepseek_v41/encoding.py:237-257 — before extracting anything, compare `omlx/patches/deepseek_v4/chat_template_v4.py` and `omlx/patches/deepseek_v41/encoding.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 210 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `omlx/patches/deepseek_v4/chat_template_v4.py:572` 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 (27–28 lines × 2) omlx/patches/mlx_vlm_mtp/qwen35_moe_vlm_model.py:133— omlx/patches/mlx_vlm_mtp/qwen35_moe_vlm_model.py:133-160 | omlx/patches/mlx_vlm_mtp/qwen35_moe_vlm_runtime.py:542-568 — 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 `omlx/patches/mlx_vlm_mtp/qwen35_moe_vlm_model.py:133` 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 (27 lines × 2) omlx/cache/boundary_snapshot_store.py:1757— omlx/cache/boundary_snapshot_store.py:1757-1784 | omlx/cache/boundary_snapshot_store.py:1920-1946 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (25–26 lines × 2) omlx/engine_pool.py:937— omlx/engine_pool.py:937-962 | omlx/engine_pool.py:1029-1053 — both copies are in the same file, so extract the 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 `omlx/engine_pool.py:937` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (21–25 lines × 2) REDACTED:1108— REDACTED:1108-1128 | omlx/engine/vlm.py:4794-4818 — before extracting anything, compare `REDACTED` and `omlx/engine/vlm.py` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 469 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 (23–25 lines × 2) omlx/scheduler.py:4093— omlx/scheduler.py:4093-4117 | omlx/scheduler.py:4139-4161 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17–25 lines × 2) REDACTED:7480— REDACTED:7480-7504 | REDACTED:7580-7596 — both copies are in the same file, so extract the 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–24 lines × 5) omlx/eval/arc.py:29— omlx/eval/arc.py:29-50 | omlx/eval/bbq.py:29-52 | omlx/eval/mathqa.py:28-50 | omlx/eval/mmlu_pro.py:31-53 | omlx/eval/safetybench.py:29-51 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 5 call sites, so a change lands once. The 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, `omlx/eval/mmlu_pro.py:27` calls `get_max_tokens` and `omlx/eval/arc.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 (18–24 lines × 2) omlx/patches/deepseek_v4/chat_template_v4.py:691— omlx/patches/deepseek_v4/chat_template_v4.py:691-714 | omlx/patches/deepseek_v41/encoding.py:742-759 — before extracting anything, compare `omlx/patches/deepseek_v4/chat_template_v4.py` and `omlx/patches/deepseek_v41/encoding.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 210 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 (23–24 lines × 2) omlx/patches/deepseek_v4/switch_layers.py:205— omlx/patches/deepseek_v4/switch_layers.py:205-227 | omlx/patches/glm_moe_dsa/switch_layers.py:59-82 — `omlx/patches/deepseek_v4/switch_layers.py` and `omlx/patches/glm_moe_dsa/switch_layers.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 6 separate duplicated blocks between them, totalling at least 75 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (20–23 lines × 2) omlx/api/anthropic_utils.py:269— omlx/api/anthropic_utils.py:269-291 | omlx/api/anthropic_utils.py:542-561 — both copies are in the same file, so extract the 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–23 lines × 2) REDACTED:4438— REDACTED:4438-4459 | REDACTED:4586-4608 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `request` to `SystemOneRequest` in one and `DecisionRequest` 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 (20–22 lines × 2) omlx/models/reranker.py:318— omlx/models/reranker.py:318-339 | omlx/models/reranker.py:506-525 — both copies are in the same file, so extract the 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 `omlx/models/reranker.py:318` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17–22 lines × 2) omlx/patches/deepseek_v4/deepseek_v4_model.py:2515— omlx/patches/deepseek_v4/deepseek_v4_model.py:2515-2531 | omlx/patches/mlx_lm_mtp/deepseek_v4_model.py:896-917 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `omlx/patches/deepseek_v4/deepseek_v4_model.py:2515` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12–22 lines × 2) omlx/patches/deepseek_v4/moe_offload.py:160— omlx/patches/deepseek_v4/moe_offload.py:160-171 | omlx/patches/glm_moe_dsa/moe_offload.py:199-220 — `omlx/patches/deepseek_v4/moe_offload.py` and `omlx/patches/glm_moe_dsa/moe_offload.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 10 separate duplicated blocks between them, totalling at least 144 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (16–22 lines × 2) omlx/patches/mlx_vlm_mtp/qwen35_moe_vlm_model.py:126— omlx/patches/mlx_vlm_mtp/qwen35_moe_vlm_model.py:126-141 | omlx/patches/mlx_vlm_mtp/qwen35_vlm_model.py:81-102 — before extracting anything, compare `omlx/patches/mlx_vlm_mtp/qwen35_moe_vlm_model.py` and `omlx/patches/mlx_vlm_mtp/qwen35_vlm_model.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 52 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `omlx/patches/mlx_vlm_mtp/qwen35_vlm_model.py:80` calls `base_layout_key` and `omlx/patches/mlx_vlm_mtp/qwen35_moe_vlm_model.py:125` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (21–22 lines × 2) REDACTED:5194— REDACTED:5194-5214 | REDACTED:8804-8825 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:5194` 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 (20–21 lines × 2) omlx/admin/routes.py:9149— omlx/admin/routes.py:9149-9168 | omlx/admin/routes.py:9419-9439 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15–21 lines × 2) omlx/cluster/node_role.py:233— omlx/cluster/node_role.py:233-253 | omlx/cluster/node_role.py:260-274 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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 (19–21 lines × 2) omlx/patches/qwen35_ane_prefill.py:2205— omlx/patches/qwen35_ane_prefill.py:2205-2225 | omlx/patches/qwen35_ane_prefill.py:2320-2338 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (18–21 lines × 2) omlx/patches/specprefill.py:498— omlx/patches/specprefill.py:498-515 | omlx/patches/specprefill.py:1068-1088 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16–21 lines × 2) omlx/scheduler.py:12421— omlx/scheduler.py:12421-12436 | omlx/scheduler.py:14940-14960 — both copies are in the same file, so extract the 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, `omlx/scheduler.py:12439` calls `get_prefill_tracker`, `remove`, `set_finished` and `omlx/scheduler.py:14963` 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 (18–20 lines × 3) omlx/patches/qwen35_ane_prefill.py:677— omlx/patches/qwen35_ane_prefill.py:677-696 | omlx/patches/qwen35_ane_prefill.py:798-815 | omlx/patches/qwen35_ane_prefill.py:893-910 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (18–20 lines × 2) omlx/oq.py:1669— omlx/oq.py:1669-1686 | omlx/oq.py:1718-1737 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10–20 lines × 2) omlx/scheduler.py:13827— omlx/scheduler.py:13827-13846 | omlx/scheduler.py:13911-13920 — both copies are in the same file, so extract the 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 `omlx/scheduler.py:13827` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `omlx/scheduler.py:13909` calls `pop`, `_release_paged_cache_for_request` and `omlx/scheduler.py:13827` 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 (16–19 lines × 3) omlx/eval/cmmlu.py:76— omlx/eval/cmmlu.py:76-91 | omlx/eval/kmmlu.py:80-96 | omlx/eval/mmlu.py:102-120 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (18–19 lines × 3) omlx/patches/deepseek_v4/deepseek_v4_model.py:1696— omlx/patches/deepseek_v4/deepseek_v4_model.py:1696-1713 | omlx/patches/deepseek_v4/deepseek_v4_model.py:1806-1824 | omlx/patches/deepseek_v4/deepseek_v4_model.py:1977-1994 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `omlx/patches/deepseek_v4/deepseek_v4_model.py:1696` 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–19 lines × 2) omlx/cluster/planner.py:629— omlx/cluster/planner.py:629-647 | omlx/cluster/planner.py:655-666 — both copies are in the same file, so extract the 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 `omlx/cluster/planner.py:629` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (15–19 lines × 2) omlx/patches/qwen35_fa256_attention.py:395— omlx/patches/qwen35_fa256_attention.py:395-409 | omlx/patches/qwen35_fa256_attention.py:436-454 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (15–18 lines × 2) omlx/cache/paged_ssd_cache.py:4229— omlx/cache/paged_ssd_cache.py:4229-4246 | omlx/cache/paged_ssd_cache.py:4252-4266 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11–18 lines × 2) omlx/cluster/planner.py:587— omlx/cluster/planner.py:587-597 | omlx/cluster/planner.py:1110-1127 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13–18 lines × 2) omlx/patches/mlx_vlm_glm5_next_compat/decode_kernels.py:2639— omlx/patches/mlx_vlm_glm5_next_compat/decode_kernels.py:2639-2651 | omlx/patches/mlx_vlm_glm5_next_compat/decode_kernels.py:2674-2691 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12–17 lines × 3) omlx/api/anthropic_utils.py:257— omlx/api/anthropic_utils.py:257-268 | omlx/api/anthropic_utils.py:320-331 | omlx/api/anthropic_utils.py:381-397 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (16–17 lines × 3) REDACTED:1503— REDACTED:1503-1518 | REDACTED:1533-1548 | omlx/engine/vlm.py:5346-5362 — before extracting anything, compare `REDACTED` and `omlx/engine/vlm.py` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1503` 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 (17 lines × 3) REDACTED:5199— REDACTED:5199-5215 | REDACTED:6106-6124 | REDACTED:8810-8826 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:5199` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16–17 lines × 2) omlx/cluster/staging.py:1132— omlx/cluster/staging.py:1132-1148 | omlx/cluster/staging.py:1376-1391 — both copies are in the same file, so extract the 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 `omlx/cluster/staging.py:1132` 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 (15–16 lines × 5) omlx/eval/arc.py:56— omlx/eval/arc.py:56-70 | omlx/eval/bbq.py:59-74 | omlx/eval/mathqa.py:56-70 | omlx/eval/mmlu_pro.py:59-73 | omlx/eval/safetybench.py:57-72 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 5 call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (16 lines × 4) REDACTED:1191— REDACTED:1191-1206 | REDACTED:1281-1296 | omlx/engine/vlm.py:4891-4906 | omlx/engine/vlm.py:5015-5030 — before extracting anything, compare `REDACTED` and `omlx/engine/vlm.py` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1191` 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 (15–16 lines × 3) omlx/eval/cmmlu.py:59— omlx/eval/cmmlu.py:59-73 | omlx/eval/kmmlu.py:63-77 | omlx/eval/mmlu.py:83-98 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `omlx/eval/kmmlu.py:61` calls `get`, `str` and `omlx/eval/cmmlu.py:58` 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 (16 lines × 3) REDACTED:6650— REDACTED:6650-6665 | REDACTED:7386-7401 | REDACTED:9153-9168 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9–16 lines × 2) omlx/scheduler.py:17295— omlx/scheduler.py:17295-17303 | omlx/utils/formatting.py:6-21 — 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 (13–15 lines × 3) omlx/eval/base.py:186— omlx/eval/base.py:186-200 | omlx/eval/livecodebench.py:50-62 | omlx/eval/mbpp.py:42-54 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. 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 (10–15 lines × 2) omlx/patches/mlx_lm_mtp/qwen35_model.py:162— omlx/patches/mlx_lm_mtp/qwen35_model.py:162-176 | omlx/patches/mlx_vlm_mtp/qwen35_vlm_runtime.py:204-213 — 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 (12–15 lines × 2) REDACTED:4624— REDACTED:4624-4635 | REDACTED:5078-5092 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 3) omlx/cluster/enrollment.py:164— omlx/cluster/enrollment.py:164-177 | omlx/cluster/rdma/store.py:50-63 | omlx/cluster/registry.py:310-323 — 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, `omlx/cluster/registry.py:326` calls `chmod` and `omlx/cluster/rdma/store.py:66` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (12–14 lines × 2) omlx/engine/vlm.py:1692— omlx/engine/vlm.py:1692-1703 | omlx/patches/mimo_v2/audio.py:48-61 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (12–13 lines × 4) REDACTED:1207— REDACTED:1207-1219 | REDACTED:1297-1308 | omlx/engine/vlm.py:4908-4920 | omlx/engine/vlm.py:5032-5043 — before extracting anything, compare `REDACTED` and `omlx/engine/vlm.py` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1207` 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 (11–13 lines × 3) omlx/patches/glm_moe_dsa/deepseek_v32.py:525— omlx/patches/glm_moe_dsa/deepseek_v32.py:525-535 | omlx/patches/glm_moe_dsa/glm_moe_dsa_model.py:223-233 | omlx/patches/index_cache.py:153-165 — 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 (3–13 lines × 3) omlx/patches/bailing_hybrid/bailing_hybrid_model.py:284— omlx/patches/bailing_hybrid/bailing_hybrid_model.py:284-286 | omlx/patches/glm_moe_dsa/deepseek_v32.py:508-520 | omlx/patches/glm_moe_dsa/glm_moe_dsa_model.py:201-213 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Note 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, `omlx/patches/glm_moe_dsa/deepseek_v32.py:507` calls `split`, `reshape`, `transpose` and `omlx/patches/bailing_hybrid/bailing_hybrid_model.py:284` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (12–13 lines × 2) omlx/server_metrics.py:300— omlx/server_metrics.py:300-311 | omlx/server_metrics.py:324-336 — both copies are in the same file, so extract the 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 `omlx/server_metrics.py:300` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9–12 lines × 3) omlx/cache/prefix_cache.py:1149— omlx/cache/prefix_cache.py:1149-1157 | omlx/cache/prefix_cache.py:2413-2421 | omlx/cache/prefix_cache.py:2714-2725 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10–12 lines × 3) omlx/cluster/incidents.py:142— omlx/cluster/incidents.py:142-151 | omlx/cluster/registry.py:247-258 | omlx/cluster/strategy_benchmarks.py:132-141 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11–12 lines × 3) REDACTED:758— REDACTED:758-769 | REDACTED:797-808 | REDACTED:872-882 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:758` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8–12 lines × 2) omlx/cache/paged_ssd_cache.py:614— omlx/cache/paged_ssd_cache.py:614-621 | omlx/cache/prefix_cache.py:4054-4065 — 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 that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (9–11 lines × 3) omlx/engine/vlm.py:3279— omlx/engine/vlm.py:3279-3288 | omlx/engine/vlm.py:3330-3340 | omlx/engine/vlm.py:3383-3391 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `omlx/engine/vlm.py:3330` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (6–10 lines × 3) omlx/patches/deepseek_v4/__init__.py:94— omlx/patches/deepseek_v4/__init__.py:94-99 | omlx/patches/minimax_m3_mlx_lm/__init__.py:59-68 | omlx/patches/step3p7/__init__.py:32-38 — 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 (7–10 lines × 2) omlx/patches/glm_moe_dsa/deepseek_v32.py:553— omlx/patches/glm_moe_dsa/deepseek_v32.py:553-559 | omlx/patches/glm_moe_dsa/glm_moe_dsa_model.py:241-250 — 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 `omlx/patches/glm_moe_dsa/glm_moe_dsa_model.py:241` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7–9 lines × 2) omlx/cache/prefix_cache.py:4267— omlx/cache/prefix_cache.py:4267-4275 | omlx/cache/prefix_cache.py:4352-4358 — both copies are in the same file, so extract the 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 `omlx/cache/prefix_cache.py:4267` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (8 lines × 7) omlx/cluster/enrollment.py:171— omlx/cluster/enrollment.py:171-178 | omlx/cluster/identity.py:143-150 | omlx/cluster/incidents.py:175-182 | REDACTED:233-240 | omlx/cluster/rdma/store.py:57-64 | omlx/cluster/registry.py:99-106 | omlx/cluster/registry.py:317-324 — there are 7 copies across 6 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 7 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `omlx/cluster/enrollment.py:171` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `omlx/cluster/enrollment.py:180` calls `chmod` and `omlx/cluster/rdma/store.py:66` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7–8 lines × 2) omlx/eval/humaneval.py:71— omlx/eval/humaneval.py:71-78 | omlx/eval/humaneval.py:81-87 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6–8 lines × 2) omlx/patches/bailing_hybrid/bailing_hybrid_model.py:928— omlx/patches/bailing_hybrid/bailing_hybrid_model.py:928-935 | omlx/patches/hy_v3/hy_v3_model.py:306-311 — 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. 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–7 lines × 2) omlx/patches/glm_moe_dsa/deepseek_v32.py:568— omlx/patches/glm_moe_dsa/deepseek_v32.py:568-574 | omlx/patches/raon1_mini/raon1_mini_model.py:1491-1496 — 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 (4–7 lines × 3) omlx/patches/glm_moe_dsa/deepseek_v32.py:819— omlx/patches/glm_moe_dsa/deepseek_v32.py:819-825 | omlx/patches/glm_moe_dsa/glm_moe_dsa_model.py:472-478 | omlx/patches/mlx_lm_mtp/glm_moe_dsa_model.py:305-308 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. 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 (3–6 lines × 3) omlx/patches/glm_moe_dsa/deepseek_v32.py:816— omlx/patches/glm_moe_dsa/deepseek_v32.py:816-818 | omlx/patches/glm_moe_dsa/glm_moe_dsa_model.py:465-471 | omlx/patches/mlx_lm_mtp/glm_moe_dsa_model.py:299-304 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `omlx/patches/glm_moe_dsa/glm_moe_dsa_model.py:465` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (23 lines × 3) omlx/models/embedding.py:1274— omlx/models/embedding.py:1274-1298 | omlx/models/llm.py:333-355 | omlx/models/reranker.py:1541-1564 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 6) omlx/patches/mlx_vlm_glm5_next_compat/__init__.py:21— omlx/patches/mlx_vlm_glm5_next_compat/__init__.py:21-26 | omlx/patches/mlx_vlm_inkling_compat/__init__.py:62-67 | omlx/patches/mlx_vlm_minimax_m3_compat/__init__.py:75-80 | omlx/patches/mlx_vlm_muse_glimmer_compat/__init__.py:57-62 | omlx/patches/mlx_vlm_muse_spark_compat/__init__.py:61-66 | omlx/patches/mlx_vlm_qwen4_exp_compat/__init__.py:20-25 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 6 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 6 times. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `omlx/patches/mlx_vlm_minimax_m3_compat/__init__.py:71` calls `_append_package_path` and `omlx/patches/mlx_vlm_inkling_compat/__init__.py:58` 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 (51 lines × 2) apps/omlx-mac/Sources/AppView/Screens/DownloadsScreen.swift:199— apps/omlx-mac/Sources/AppView/Screens/DownloadsScreen.swift:199-249 | apps/omlx-mac/Sources/AppView/Screens/DownloadsScreen.swift:355-405 — both copies are in the same file, so extract the 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 (36 lines × 2) apps/omlx-mac/Sources/AppView/Screens/DownloadsScreen.swift:287— apps/omlx-mac/Sources/AppView/Screens/DownloadsScreen.swift:287-322 | apps/omlx-mac/Sources/AppView/Screens/DownloadsScreen.swift:443-478 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (23 lines × 2) apps/omlx-mac/Sources/App/AppDelegate.swift:647— apps/omlx-mac/Sources/App/AppDelegate.swift:647-669 | apps/omlx-mac/Sources/App/AppDelegate.swift:682-704 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (19–20 lines × 2) apps/omlx-mac/Sources/AppView/Screens/AccuracyBenchScreen.swift:799— apps/omlx-mac/Sources/AppView/Screens/AccuracyBenchScreen.swift:799-818 | apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift:858-876 — 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 `apps/omlx-mac/Sources/AppView/Screens/AccuracyBenchScreen.swift:799` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (7–18 lines × 2) apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:558— apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:558-564 | apps/omlx-mac/Sources/AppView/Screens/LogsScreen.swift:62-79 — 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 `apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:558` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (11–16 lines × 4) apps/omlx-mac/Sources/AppView/Screens/AppearanceScreen.swift:250— apps/omlx-mac/Sources/AppView/Screens/AppearanceScreen.swift:250-265 | apps/omlx-mac/Sources/AppView/Screens/IntegrationsScreen.swift:620-632 | apps/omlx-mac/Sources/AppView/Screens/NetworkScreen.swift:131-143 | apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:80-90 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/omlx-mac/Sources/AppView/Screens/AppearanceScreen.swift:250` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note first that the copies are not typed on the same thing: the declarations holding them bind `label` to `String(localized: "network.row.https_proxy.label", defaultValue: "HTTPS proxy", comment: "Row label for the HTTPS_PROXY field on the Network screen")` in one and `String(localized: "server.row.listen_address", defaultValue: "Listen Address", comment: "Row label for the listen-address picker in Server screen")` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (8–15 lines × 18) apps/omlx-mac/Sources/AppView/Screens/AppearanceScreen.swift:35— apps/omlx-mac/Sources/AppView/Screens/AppearanceScreen.swift:35-49 | apps/omlx-mac/Sources/AppView/Screens/AppearanceScreen.swift:249-262 | apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:208-218 | apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:277-286 | apps/omlx-mac/Sources/AppView/Screens/IntegrationsScreen.swift:619-629 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:990-1001 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1364-1371 | apps/omlx-mac/Sources/AppView/Screens/NetworkScreen.swift:130-140 | apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift:76-87 | apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift:151-162 | apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift:303-314 | apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:171-182 | apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:437-447 | apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:936-947 | apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:1070-1079 | apps/omlx-mac/Sources/AppView/Screens/SecurityScreen.swift:209-219 | apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:79-87 | apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:154-164 — there are 18 copies across 9 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 18 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `apps/omlx-mac/Sources/AppView/Screens/AppearanceScreen.swift:35` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `label` to `String(localized: "network.row.https_proxy.label", defaultValue: "HTTPS proxy", comment: "Row label for the HTTPS_PROXY field on the Network screen")` in one and `String(localized: "server.row.listen_address", defaultValue: "Listen Address", comment: "Row label for the listen-address picker in Server screen")` 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 (10–15 lines × 3) apps/omlx-mac/Sources/AppView/Screens/AppearanceScreen.swift:31— apps/omlx-mac/Sources/AppView/Screens/AppearanceScreen.swift:31-45 | apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:1023-1032 | apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:1067-1076 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/omlx-mac/Sources/AppView/Screens/AppearanceScreen.swift:31` 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 (11–14 lines × 2) apps/omlx-mac/Sources/AppView/Screens/DownloadsScreen.swift:751— apps/omlx-mac/Sources/AppView/Screens/DownloadsScreen.swift:751-761 | apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:510-523 — 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 `apps/omlx-mac/Sources/AppView/Screens/DownloadsScreen.swift:751` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12–13 lines × 9) apps/omlx-mac/Sources/AppView/Screens/IntegrationsScreen.swift:223— apps/omlx-mac/Sources/AppView/Screens/IntegrationsScreen.swift:223-234 | apps/omlx-mac/Sources/AppView/Screens/IntegrationsScreen.swift:614-626 | apps/omlx-mac/Sources/AppView/Screens/NetworkScreen.swift:69-80 | apps/omlx-mac/Sources/AppView/Screens/NetworkScreen.swift:125-137 | apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift:71-83 | apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift:146-158 | apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift:298-310 | apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:432-444 | apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:149-160 — before extracting anything, compare `apps/omlx-mac/Sources/AppView/Screens/IntegrationsScreen.swift` and `apps/omlx-mac/Sources/AppView/Screens/NetworkScreen.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 67 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 `apps/omlx-mac/Sources/AppView/Screens/IntegrationsScreen.swift:223` 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 first that the copies are not typed on the same thing: the declarations holding them bind `label` to `String(localized: "network.row.https_proxy.label", defaultValue: "HTTPS proxy", comment: "Row label for the HTTPS_PROXY field on the Network screen")` in one and `String(localized: "server.row.log_level", defaultValue: "Log Level", comment: "Row label for the log level picker")` 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 before the matched lines, `apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift:143` calls `Environment` and `apps/omlx-mac/Sources/AppView/Screens/NetworkScreen.swift:66` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13 lines × 4) apps/omlx-mac/Sources/AppView/Screens/AccuracyBenchScreen.swift:44— apps/omlx-mac/Sources/AppView/Screens/AccuracyBenchScreen.swift:44-56 | apps/omlx-mac/Sources/AppView/Screens/ContextBenchScreen.swift:32-44 | apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:51-63 | apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift:44-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 all 4 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `apps/omlx-mac/Sources/AppView/Screens/AccuracyBenchScreen.swift:44` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift:59` calls `DeviceChip` and `apps/omlx-mac/Sources/AppView/Screens/AccuracyBenchScreen.swift:58` 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–13 lines × 3) apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2309— apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2309-2316 | apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:743-755 | apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift:271-282 — 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 `apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2309` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (12–13 lines × 3) apps/omlx-mac/Sources/AppView/Screens/NetworkScreen.swift:47— apps/omlx-mac/Sources/AppView/Screens/NetworkScreen.swift:47-58 | apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift:49-60 | apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:210-222 — before extracting anything, compare `apps/omlx-mac/Sources/AppView/Screens/NetworkScreen.swift` and `apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 95 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 `apps/omlx-mac/Sources/AppView/Screens/NetworkScreen.swift:47` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (9–12 lines × 10) apps/omlx-mac/Sources/AppView/Screens/IntegrationsScreen.swift:574— apps/omlx-mac/Sources/AppView/Screens/IntegrationsScreen.swift:574-582 | apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift:176-187 | apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:32-40 | apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:109-117 | apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:760-768 | apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:74-83 | apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:114-123 | apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:142-151 | apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:165-174 | apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:201-210 — there are 10 copies across 4 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 10 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:74` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `apps/omlx-mac/Sources/AppView/Screens/IntegrationsScreen.swift:583` calls `String` and `apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:769` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7–12 lines × 2) apps/omlx-mac/Sources/Updater/AppUpdater.swift:552— apps/omlx-mac/Sources/Updater/AppUpdater.swift:552-558 | apps/omlx-mac/Sources/Updater/UpdateInstaller.swift:305-316 — 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 `apps/omlx-mac/Sources/Updater/UpdateInstaller.swift:305` 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 (11 lines × 5) apps/omlx-mac/Sources/AppView/Screens/AppearanceScreen.swift:36— apps/omlx-mac/Sources/AppView/Screens/AppearanceScreen.swift:36-50 | apps/omlx-mac/Sources/AppView/Screens/ContextBenchScreen.swift:109-119 | apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:172-184 | apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:1071-1081 | apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift:188-198 — there are 5 copies across 4 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `apps/omlx-mac/Sources/AppView/Screens/AppearanceScreen.swift:36` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with 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 (10 lines × 13) apps/omlx-mac/Sources/AppView/Screens/AppearanceScreen.swift:36— apps/omlx-mac/Sources/AppView/Screens/AppearanceScreen.swift:36-50 | apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:209-219 | apps/omlx-mac/Sources/AppView/Screens/ContextBenchScreen.swift:109-118 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:991-1002 | apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift:77-88 | apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift:152-163 | apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift:304-315 | apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:172-183 | apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:937-948 | apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:1071-1080 | apps/omlx-mac/Sources/AppView/Screens/SecurityScreen.swift:210-220 | apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:155-165 | apps/omlx-mac/Sources/AppView/Screens/ThroughputBenchScreen.swift:188-197 — there are 13 copies across 9 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 13 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `apps/omlx-mac/Sources/AppView/Screens/AppearanceScreen.swift:36` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with 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 (10 lines × 9) apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2648— apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2648-2657 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2659-2668 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2670-2679 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2681-2690 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2709-2718 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2720-2729 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2731-2740 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2742-2751 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2771-2780 — all 9 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2648` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (10 lines × 4) apps/omlx-mac/Sources/AppView/Screens/NetworkScreen.swift:97— apps/omlx-mac/Sources/AppView/Screens/NetworkScreen.swift:97-108 | apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift:384-393 | apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:45-55 | apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:770-781 — before extracting anything, compare `apps/omlx-mac/Sources/AppView/Screens/NetworkScreen.swift` and `apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 95 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 `apps/omlx-mac/Sources/AppView/Screens/NetworkScreen.swift:97` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. Note first that the copies are not typed on the same thing: the declarations holding them bind `label` to `String(localized: "network.row.https_proxy.label", defaultValue: "HTTPS proxy", comment: "Row label for the HTTPS_PROXY field on the Network screen")` in one and `String(localized: "server.row.listen_address", defaultValue: "Listen Address", comment: "Row label for the listen-address picker in Server screen")` 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 before the matched lines, `apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift:382` calls `disabled`, `Row` and `apps/omlx-mac/Sources/AppView/Screens/NetworkScreen.swift:97` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8–9 lines × 6) apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:1177— apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:1177-1185 | apps/omlx-mac/Sources/AppView/Screens/DownloadsScreen.swift:861-868 | apps/omlx-mac/Sources/AppView/Screens/ModelsScreen.swift:115-122 | apps/omlx-mac/Sources/AppView/Screens/ProfileViews.swift:721-729 | apps/omlx-mac/Sources/AppView/Screens/SecurityScreen.swift:378-385 | apps/omlx-mac/Sources/AppView/Screens/StatusScreen.swift:539-546 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 6 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:1177` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8–9 lines × 4) apps/omlx-mac/Sources/AppView/Screens/AboutScreen.swift:95— apps/omlx-mac/Sources/AppView/Screens/AboutScreen.swift:95-103 | apps/omlx-mac/Sources/AppView/Screens/AboutScreen.swift:105-113 | apps/omlx-mac/Sources/AppView/Screens/AboutScreen.swift:115-123 | apps/omlx-mac/Sources/AppView/Screens/AboutScreen.swift:124-131 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/omlx-mac/Sources/AppView/Screens/AboutScreen.swift:95` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with 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 (7–9 lines × 3) apps/omlx-mac/Sources/AppView/Screens/StatusScreen.swift:154— apps/omlx-mac/Sources/AppView/Screens/StatusScreen.swift:154-162 | apps/omlx-mac/Sources/AppView/Screens/StatusScreen.swift:172-180 | apps/omlx-mac/Sources/AppView/Screens/StatusScreen.swift:188-194 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/omlx-mac/Sources/AppView/Screens/StatusScreen.swift:154` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with 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 (8 lines × 10) apps/omlx-mac/Sources/AppView/Screens/AppearanceScreen.swift:33— apps/omlx-mac/Sources/AppView/Screens/AppearanceScreen.swift:33-46 | apps/omlx-mac/Sources/AppView/Screens/AppearanceScreen.swift:247-260 | apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:207-216 | apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:276-285 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:989-1000 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1363-1370 | apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:1025-1033 | apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:1069-1077 | apps/omlx-mac/Sources/AppView/Screens/SecurityScreen.swift:208-217 | apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:78-86 — there are 10 copies across 6 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 10 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `apps/omlx-mac/Sources/AppView/Screens/AppearanceScreen.swift:33` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `apps/omlx-mac/Sources/AppView/Screens/SecurityScreen.swift:204` calls `Environment` and `apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:986` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 19) apps/omlx-mac/Sources/AppView/Screens/AppearanceScreen.swift:34— apps/omlx-mac/Sources/AppView/Screens/AppearanceScreen.swift:34-46 | apps/omlx-mac/Sources/AppView/Screens/AppearanceScreen.swift:248-260 | apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:208-216 | apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:277-285 | apps/omlx-mac/Sources/AppView/Screens/IntegrationsScreen.swift:619-628 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:990-1000 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1364-1370 | apps/omlx-mac/Sources/AppView/Screens/NetworkScreen.swift:130-139 | apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift:76-85 | apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift:151-160 | apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift:303-312 | apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:171-180 | apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:437-446 | apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:936-945 | apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:1026-1033 | apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:1070-1077 | apps/omlx-mac/Sources/AppView/Screens/SecurityScreen.swift:209-217 | apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:79-86 | apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:154-162 — there are 19 copies across 9 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 19 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `apps/omlx-mac/Sources/AppView/Screens/AppearanceScreen.swift:34` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `label` to `String(localized: "network.row.https_proxy.label", defaultValue: "HTTPS proxy", comment: "Row label for the HTTPS_PROXY field on the Network screen")` in one and `String(localized: "server.row.listen_address", defaultValue: "Listen Address", comment: "Row label for the listen-address picker in Server screen")` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (7 lines × 10) apps/omlx-mac/Sources/AppView/Screens/IntegrationsScreen.swift:580— apps/omlx-mac/Sources/AppView/Screens/IntegrationsScreen.swift:580-586 | apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift:184-192 | apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:38-44 | apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:118-124 | apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:763-769 | apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:96-102 | apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:130-136 | apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:155-161 | apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:169-175 | apps/omlx-mac/Sources/AppView/ViewModels/ModelSettingsScreenVM.swift:208-214 — there are 10 copies across 4 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 10 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `apps/omlx-mac/Sources/AppView/Screens/IntegrationsScreen.swift:580` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 7) apps/omlx-mac/Sources/AppView/Screens/AccuracyBenchScreen.swift:602— apps/omlx-mac/Sources/AppView/Screens/AccuracyBenchScreen.swift:602-608 | apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:1292-1298 | apps/omlx-mac/Sources/AppView/Screens/DownloadsScreen.swift:675-681 | apps/omlx-mac/Sources/AppView/Screens/DownloadsScreen.swift:779-785 | apps/omlx-mac/Sources/AppView/Screens/DownloadsScreen.swift:893-899 | apps/omlx-mac/Sources/AppView/Screens/ModelsScreen.swift:146-152 | apps/omlx-mac/Sources/AppView/Screens/ModelsScreen.swift:349-355 — there are 7 copies across 4 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 7 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `apps/omlx-mac/Sources/AppView/Screens/AccuracyBenchScreen.swift:602` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (7 lines × 4) apps/omlx-mac/Sources/AppView/ViewModels/IntegrationsScreenVM.swift:161— apps/omlx-mac/Sources/AppView/ViewModels/IntegrationsScreenVM.swift:161-167 | apps/omlx-mac/Sources/AppView/ViewModels/ServerScreenVM.swift:527-533 | apps/omlx-mac/Sources/Welcome/WelcomeWindow.swift:227-233 | apps/omlx-mac/Sources/Welcome/WelcomeWindow.swift:244-250 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `apps/omlx-mac/Sources/AppView/ViewModels/IntegrationsScreenVM.swift:161` 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 × 12) apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1124— apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1124-1129 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1155-1160 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1163-1168 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2300-2307 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2311-2316 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2652-2657 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2663-2668 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2674-2679 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2713-2718 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2724-2729 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2735-2740 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2775-2780 — all 12 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1124` 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 × 11) apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1124— apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1124-1129 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2311-2316 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2652-2657 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2663-2668 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2674-2679 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2713-2718 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2724-2729 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2735-2740 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:2775-2780 | apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:503-508 | apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:511-516 — there are 11 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 11 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1124` 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 × 7) apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1155— apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1155-1160 | apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1163-1168 | apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift:91-98 | apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift:101-108 | apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:519-524 | apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:527-532 | apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:533-540 — there are 7 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 7 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1155` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:527` calls `Row`, `String` and `apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:533` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 4) apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:693— apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:693-698 | apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:1061-1066 | apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:1538-1543 | apps/omlx-mac/Sources/AppView/Screens/QuantizationScreen.swift:870-875 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `apps/omlx-mac/Sources/AppView/Screens/AskAIScreen.swift:693` 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 first that the copies are not typed on the same thing: the declarations holding them bind `spacing` to `14` in one and `4` 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 (5–6 lines × 3) apps/omlx-mac/Sources/AppView/AppServices.swift:378— apps/omlx-mac/Sources/AppView/AppServices.swift:378-383 | apps/omlx-mac/Sources/AppView/AppServices.swift:385-390 | apps/omlx-mac/Sources/AppView/AppServices.swift:391-395 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/omlx-mac/Sources/AppView/AppServices.swift:378` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `apps/omlx-mac/Sources/AppView/AppServices.swift:385` calls `relocate` and `apps/omlx-mac/Sources/AppView/AppServices.swift:391` does not — after which the two agree again for 5 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5–6 lines × 2) apps/omlx-mac/Sources/AppView/Utils/PresetBundleStore.swift:62— apps/omlx-mac/Sources/AppView/Utils/PresetBundleStore.swift:62-66 | apps/omlx-mac/Sources/Config/AppConfig.swift:271-276 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 4) apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1124— apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1124-1128 | apps/omlx-mac/Sources/AppView/Screens/PerformanceScreen.swift:232-242 | apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:503-507 | apps/omlx-mac/Sources/AppView/Screens/ServerScreen.swift:511-515 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift:1124` 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.
Type Safety — 0 typed · 17 plain JS — the untyped files are apps/omlx-web/omlx_web/static/js/cluster_v2.js, apps/omlx-web/omlx_web/static/js/count_format.js, apps/omlx-web/omlx_web/static/js/custom_theme.js, REDACTED, apps/omlx-web/omlx_web/static/js/dashboard_layout.js, REDACTED (+11 more).
R10 · Code Duplication· Duplicated block with local edits (96 matched lines × 2 locations) · ×1
Duplicated block with local edits (96 matched lines × 2 locations) REDACTED:7969— REDACTED:7969 · REDACTED:8267 — the two spans are one implementation copied and then locally edited — 607 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block (45 lines × 2 locations) REDACTED:7733— REDACTED:7733 · REDACTED:9096 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (35 lines × 2 locations) REDACTED:7855— REDACTED:7855 · REDACTED:9146 — both copies are in the same file, so extract the 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 (32 lines × 2 locations) REDACTED:7226— REDACTED:7226 · REDACTED:7331 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (20 lines × 5 locations) REDACTED:8410— REDACTED:8410 · REDACTED:8844 · REDACTED:9222 · REDACTED:9287 · +1 more site(s) not listed — all 5 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (19 lines × 2 locations) REDACTED:8784— REDACTED:8784 · REDACTED:9250 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (17 lines × 3 locations) apps/omlx-web/omlx_web/static/js/cluster_v2.js:3427— apps/omlx-web/omlx_web/static/js/cluster_v2.js:3427 · apps/omlx-web/omlx_web/static/js/cluster_v2.js:3740 · apps/omlx-web/omlx_web/static/js/cluster_v2.js:3764 — all 3 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (16 lines × 4 locations) REDACTED:7916— REDACTED:7916 · REDACTED:8066 · REDACTED:8359 · REDACTED:9186 — all 4 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (13 lines × 2 locations) apps/omlx-web/omlx_web/static/js/cluster_v2.js:667— apps/omlx-web/omlx_web/static/js/cluster_v2.js:667 · apps/omlx-web/omlx_web/static/js/cluster_v2.js:682 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (13 lines × 3 locations) REDACTED:1900— REDACTED:1900 · REDACTED:1913 · REDACTED:7775 — all 3 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (12 lines × 3 locations) REDACTED:6242— REDACTED:6242 · REDACTED:8048 · REDACTED:8341 — all 3 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (9 lines × 4 locations) REDACTED:2841— REDACTED:2841 · REDACTED:2865 · REDACTED:2903 · REDACTED:2977 — all 4 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (6 lines × 6 locations) REDACTED:2529— REDACTED:2529 · REDACTED:7736 · REDACTED:8493 · REDACTED:8843 · +2 more site(s) not listed — all 6 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (6 lines × 3 locations) REDACTED:5014— REDACTED:5014 · REDACTED:5078 · REDACTED:8715 — all 3 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (6 lines × 2 locations) REDACTED:5124— REDACTED:5124 · REDACTED:5136 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Complex function buildModelSettingsPayload (cyclomatic 91, cognitive 108) REDACTED:3490— buildModelSettingsPayload has cyclomatic complexity 91 and cognitive complexity 108; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function buildModelSettingsState (cyclomatic 87, cognitive 84) REDACTED:2155— buildModelSettingsState has cyclomatic complexity 87 and cognitive complexity 84; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function formValuesForProfile (cyclomatic 52, cognitive 95) REDACTED:1730— formValuesForProfile has cyclomatic complexity 52 and cognitive complexity 95; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function accDownloadResult (cyclomatic 36, cognitive 56) REDACTED:6531— accDownloadResult has cyclomatic complexity 36 and cognitive complexity 56; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function checkRows (cyclomatic 33, cognitive 40) apps/omlx-web/omlx_web/static/js/cluster_v2.js:2073— checkRows has cyclomatic complexity 33 and cognitive complexity 40; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function saveGlobalSettings (cyclomatic 33, cognitive 38) REDACTED:1402— saveGlobalSettings has cyclomatic complexity 33 and cognitive complexity 38; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 31, cognitive 32) REDACTED:7192— (anonymous) has cyclomatic complexity 31 and cognitive complexity 32; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function prefillHelperStatusText (cyclomatic 28, cognitive 21) REDACTED:3284— prefillHelperStatusText has cyclomatic complexity 28 and cognitive complexity 21; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function applyANETuningRecommendation (cyclomatic 26, cognitive 34) REDACTED:2919— applyANETuningRecommendation has cyclomatic complexity 26 and cognitive complexity 34; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function runPlan (cyclomatic 25, cognitive 24) apps/omlx-web/omlx_web/static/js/cluster_v2.js:2819— runPlan has cyclomatic complexity 25 and cognitive complexity 24; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function wizardState (cyclomatic 24, cognitive 23) apps/omlx-web/omlx_web/static/js/cluster_v2.js:1069— wizardState has cyclomatic complexity 24 and cognitive complexity 23; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function validateQwenAneSettings (cyclomatic 22, cognitive 30) REDACTED:3413— validateQwenAneSettings has cyclomatic complexity 22 and cognitive complexity 30; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function openModelSettings (cyclomatic 22, cognitive 29) REDACTED:3011— openModelSettings has cyclomatic complexity 22 and cognitive complexity 29; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 21, cognitive 29) apps/omlx-web/omlx_web/static/js/cluster_v2.js:1903— (anonymous) has cyclomatic complexity 21 and cognitive complexity 29; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function aggregateLogRows (cyclomatic 20, cognitive 24) REDACTED:71— aggregateLogRows has cyclomatic complexity 20 and cognitive complexity 24; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function defaults (cyclomatic 19, cognitive 40) apps/omlx-web/omlx_web/static/js/custom_theme.js:181— defaults has cyclomatic complexity 19 and cognitive complexity 40; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function handleMainTabChange (cyclomatic 19, cognitive 30) REDACTED:890— handleMainTabChange has cyclomatic complexity 19 and cognitive complexity 30; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function accBuildText (cyclomatic 19, cognitive 30) REDACTED:6410— accBuildText has cyclomatic complexity 19 and cognitive complexity 30; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function submitPairApproval (cyclomatic 19, cognitive 28) apps/omlx-web/omlx_web/static/js/cluster_v2.js:1431— submitPairApproval has cyclomatic complexity 19 and cognitive complexity 28; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function saveModelSettings (cyclomatic 19, cognitive 27) REDACTED:3729— saveModelSettings has cyclomatic complexity 19 and cognitive complexity 27; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
REDACTED: 8688 lines of code REDACTED:1— REDACTED has 8688 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· apps/omlx-web/omlx_web/static/js/cluster_v2.js · ×1
apps/omlx-web/omlx_web/static/js/cluster_v2.js: 3983 lines of code apps/omlx-web/omlx_web/static/js/cluster_v2.js:1— apps/omlx-web/omlx_web/static/js/cluster_v2.js has 3983 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
X1 · Async correctness· Task from `asyncio.create_task` is not kept · ×1
Task from `asyncio.create_task` is not kept omlx/engine_core.py:1513— The task this creates is not kept anywhere. The event loop holds only a weak reference to its tasks, so a task nobody references can be garbage-collected before it finishes (Python's documentation for `asyncio.create_task`: save a reference to the result); and nothing ever awaits it, so an exception it raises is never handled — it surfaces, if at all, as "Task exception was never retrieved" in a log. Keep the task: `await` it, gather it, start it in an `asyncio.TaskGroup` (`async with asyncio.TaskGroup() as tg: tg.create_task(…)`), or, for genuine fire-and-forget, add it to a set and `task.add_done_callback(tasks.discard)` with a callback that also reads its exception.
Interpolated log message defeats structured logging omlx/engine_core.py:455— `debug` at line 455 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging omlx/engine_core.py:696— `error` at line 696 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging omlx/engine_core.py:842— `debug` at line 842 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging omlx/engine_core.py:1016— `warning` at line 1016 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging omlx/engine_core.py:1096— `debug` at line 1096 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging omlx/engine_core.py:1145— `warning` at line 1145 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging omlx/engine_core.py:1200— `info` at line 1200 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging omlx/engine_core.py:1305— `debug` at line 1305 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging omlx/engine_core.py:1461— `debug` at line 1461 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging omlx/engine_pool.py:1588— `info` at line 1588 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging omlx/engine_pool.py:1614— `warning` at line 1614 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging omlx/engine_pool.py:1616— `info` at line 1616 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging omlx/engine_pool.py:1650— `info` at line 1650 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging omlx/engine_pool.py:1667— `warning` at line 1667 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging omlx/engine_pool.py:1670— `info` at line 1670 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging omlx/engine_pool.py:2815— `info` at line 2815 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging omlx/engine_pool.py:2922— `info` at line 2922 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging omlx/engine_pool.py:2938— `info` at line 2938 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging omlx/engine_pool.py:2968— `info` at line 2968 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging omlx/engine_pool.py:2985— `warning` at line 2985 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging omlx/engine_pool.py:3192— `debug` at line 3192 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging omlx/engine_pool.py:3752— `warning` at line 3752 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging omlx/engine_pool.py:3775— `info` at line 3775 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging omlx/engine_pool.py:3799— `error` at line 3799 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging omlx/engine_pool.py:3806— `warning` at line 3806 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
Duplicated predicate omlx/patches/deepseek_v4/deepseek_v4_model.py:2447— `".ffn.experts." in wk and ".shared_experts." not in wk and weight.dtype in (mx.int8, mx.uint8) and v.shape[-1] * 16 == weight.shape[-1]` appears character-identically in 2 files — omlx/patches/deepseek_v4/deepseek_v4_model.py, omlx/patches/mlx_lm_mtp/deepseek_v4_model.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 omlx/patches/deepseek_v4/deepseek_v4_model.py:2519— `".ffn.switch_mlp." not in key or not key.endswith((".scales", ".biases")) or value.dtype != mx.bfloat16` appears character-identically in 2 files — omlx/patches/deepseek_v4/deepseek_v4_model.py, omlx/patches/mlx_lm_mtp/deepseek_v4_model.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 omlx/patches/mlx_lm_mtp/qwen35_model.py:704— `"conv1d.weight" in k and getattr(v, "shape", (1,))[-1] != 1` appears character-identically in 4 files — omlx/patches/mlx_lm_mtp/qwen35_model.py, omlx/patches/mlx_vlm_mtp/qwen35_moe_vlm_model.py, omlx/patches/mlx_vlm_mtp/qwen35_moe_vlm_runtime.py, omlx/patches/mlx_vlm_mtp/qwen35_vlm_model.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 omlx/patches/mlx_vlm_mtp/qwen35_moe_vlm_model.py:141— `"conv1d.weight" in key and value.shape[-1] != 1` appears character-identically in 3 files — omlx/patches/mlx_vlm_mtp/qwen35_moe_vlm_model.py, omlx/patches/mlx_vlm_mtp/qwen35_moe_vlm_runtime.py, omlx/patches/mlx_vlm_mtp/qwen35_vlm_model.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate REDACTED:2196— `_cfg_get(config, "num_attention_heads") or _cfg_get(config, "n_head") or num_kv_heads` appears character-identically in 2 files — REDACTED, omlx/scheduler.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate REDACTED:2183— `_cfg_get(config, "num_attention_heads") or num_kv_heads` appears character-identically in 2 files — REDACTED, omlx/scheduler.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate REDACTED:2164— `_cfg_get(sub, "num_hidden_layers") or _cfg_get(sub, "n_layer")` appears character-identically in 2 files — REDACTED, omlx/scheduler.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 omlx/custom_kernels/attention/fast.py:312— `_ext is not None and hasattr(_ext, name)` appears character-identically in 4 files — omlx/custom_kernels/attention/fast.py, omlx/custom_kernels/lowbit/fast.py, omlx/custom_kernels/quant_matmul/fast.py, omlx/custom_kernels/sparse_index/fast.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 omlx/patches/glm_moe_dsa/generate_patch.py:65— `adaptive_prefill is not None and processed_tokens >= adaptive_prefill.after and remaining_tokens >= adaptive_prefill.min_remaining` appears character-identically in 2 files — omlx/patches/glm_moe_dsa/generate_patch.py, omlx/patches/minimax_m3/generate_patch.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 omlx/patches/deepseek_v4/chat_template_v4.py:661— `add_default_bos_token and len(context) == 0` appears character-identically in 2 files — omlx/patches/deepseek_v4/chat_template_v4.py, omlx/patches/deepseek_v41/encoding.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate REDACTED:88— `address.is_private or address.is_link_local` appears character-identically in 2 files — REDACTED, omlx/cluster/routes.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate omlx/cluster/liveness.py:89— `age is not None and age > _DEFAULT_STALE_AFTER` appears character-identically in 2 files — omlx/cluster/liveness.py, omlx/engine/distributed.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 omlx/patches/qwen35_ane_prefill.py:196— `args and isinstance(args[0], bool) and args[0]` appears character-identically in 2 files — omlx/patches/qwen35_ane_prefill.py, omlx/patches/qwen35_moe_weighted_sum.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 omlx/scheduler.py:11081— `block_table and block_table.num_tokens > 0` appears character-identically in 2 files — omlx/scheduler.py, omlx/specprefill/draft.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 omlx/patches/mlx_lm_mtp/nemotron_h_chain.py:120— `cache is not None and 0 < n_confirmed < S` appears character-identically in 2 files — omlx/patches/mlx_lm_mtp/nemotron_h_chain.py, omlx/patches/mlx_lm_mtp/nemotron_h_model.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 omlx/patches/glm_moe_dsa/deepseek_v32.py:550— `cache is not None and cache[0] is not None` appears character-identically in 5 files — omlx/patches/glm_moe_dsa/deepseek_v32.py, omlx/patches/index_cache.py, omlx/patches/mlx_lm_mtp/qwen35_model.py, omlx/patches/mlx_vlm_mtp/glm5_next_vlm_runtime.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 omlx/patches/qwen35_fa256_attention.py:115— `cache is not None and hasattr(cache, "bits")` appears character-identically in 3 files — omlx/patches/qwen35_fa256_attention.py, omlx/patches/qwen35_verify_sdpa_split.py, omlx/patches/sdpa256_attention.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 omlx/patches/mlx_lm_mtp/deepseek_v4_model.py:650— `callable(is_trimmable) and is_trimmable()` appears character-identically in 2 files — omlx/patches/mlx_lm_mtp/deepseek_v4_model.py, omlx/patches/mlx_vlm_mtp/glm5_next_vlm_runtime.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 omlx/patches/deepseek_v4/deepseek_v4_model.py:2488— `candidate in weights or candidate in remapped` appears character-identically in 2 files — omlx/patches/deepseek_v4/deepseek_v4_model.py, omlx/patches/mlx_lm_mtp/deepseek_v4_model.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 omlx/engine/distributed.py:119— `candidate is not None and candidate != normalized` appears character-identically in 2 files — omlx/engine/distributed.py, omlx/reasoning_effort.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 omlx/cluster/jaccl_side_channel.py:297— `candidate.is_file() and os.access(candidate, os.X_OK)` appears character-identically in 2 files — omlx/cluster/jaccl_side_channel.py, omlx/cluster/system_socket_proxy.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 omlx/patches/mlx_lm_mtp/drafter_target.py:86— `capture_layer_ids is None and not return_hidden and scope and inputs is not None and inputs.ndim == 2 and tuple(inputs.shape) == (len(scope)…` appears character-identically in 2 files — omlx/patches/mlx_lm_mtp/drafter_target.py, omlx/patches/mlx_lm_mtp/qwen35_model.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 omlx/patches/minimax_m3/generate_patch.py:64— `child is not None and not isinstance( child, (str, bytes, int, float, bool) )` appears character-identically in 2 files — omlx/patches/minimax_m3/generate_patch.py, omlx/scheduler.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 omlx/admin/routes.py:237— `completed.stderr.strip() or completed.stdout.strip()` appears character-identically in 3 files — omlx/admin/routes.py, omlx/cluster/launch.py, omlx/engine/distributed.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 omlx/oq.py:2448— `config.get("mtp_num_hidden_layers", 0) or 0` appears character-identically in 2 files — omlx/oq.py, omlx/utils/model_loading.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.
Silent fallback default in catch apps/omlx-web/omlx_web/routes.py:73— `_load_locale` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch omlx/admin/routes.py:9628— `_read_update_channel` swallows every exception into `return 'stable'` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch omlx/cluster/autoconfigure.py:1073— `_distributions_by_module` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch REDACTED:2237— `announced_caps` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch REDACTED:802— `_allowed_model_roots` swallows every exception into `return ()` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch omlx/cluster/node_role.py:223— `_enforcer_ceiling_bytes` swallows every exception into `return 0` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch REDACTED:929— `local_addrs` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch omlx/cluster/probe.py:81— `available` (in `detect_accelerator_hardware`) swallows every exception into `return False` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch omlx/engine_pool.py:1121— `_current_ceiling` swallows every exception into `return 0` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch omlx/engine_pool.py:1138— `_fallback_admission_ceiling` swallows every exception into `return 0` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch omlx/engine_pool.py:1154— `_residency_ceiling` swallows every exception into `return 0` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch omlx/engine_pool.py:1171— `_admission_soft_target` swallows every exception into `return 0` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch REDACTED:412— `_get_process_rss` swallows every exception into `return 0` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch REDACTED:2121— `_ane_prefill_transient_bytes` swallows every exception into `return 0` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch omlx/oq.py:4303— `_system_available_memory_bytes` swallows every exception into `return 0` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch omlx/patches/mlx_vlm_qwen4_exp_compat/vendor/mlx_vlm/models/qwen4_exp/attn_fused.py:494— `_gpu_class` swallows every exception into `return ''` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch omlx/patches/mlx_vlm_qwen4_exp_compat/vendor/mlx_vlm/models/qwen4_exp/hc_fused.py:933— `_gpu_class` swallows every exception into `return ''` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch omlx/patches/mlx_vlm_qwen4_exp_compat/vendor/mlx_vlm/models/qwen4_exp/qsa_fast.py:533— `_gpu_class` swallows every exception into `return ''` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch omlx/patches/qwen35_verify_sdpa_split.py:99— `_gpu_class` swallows every exception into `return ''` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch omlx/process_memory_enforcer.py:208— `_get_max_metal_working_set_bytes` swallows every exception into `return 0` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch omlx/scheduler.py:1500— `_cache_layer_token_count` swallows every exception into `return 0` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure omlx/admin/external_api.py:289— `_usage_int` returns `0` when `(TypeError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure REDACTED:1162— `_get_param_count` returns `0` when `(TypeError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure omlx/admin/ms_downloader.py:156— `_estimate_params_from_config` returns `0` when `(TypeError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure omlx/cache/boundary_snapshot_store.py:1806— `_read_state_tuple_raw` returns `[]` when `(ValueError, TypeError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure omlx/cache/boundary_snapshot_store.py:1963— `_read_state_tuple_arrays` returns `[]` when `(ValueError, TypeError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure omlx/cache/paged_ssd_cache.py:3133— `_gdn_state_dtype_from_signature` returns `'fp32'` when `(TypeError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure omlx/cluster/autoconfigure.py:941— `_dispatch_rules` returns `()` when `(OSError, SyntaxError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure omlx/cluster/autoconfigure.py:1101— `_model_config` returns `{}` when `(OSError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure REDACTED:416— `_distribution_versions` returns `{}` when `(OSError, subprocess.SubprocessError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure omlx/cluster/inference_worker.py:606— `_distributed_model_type` returns `''` when `(OSError, TypeError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure omlx/cluster/probe.py:147— `_system_memory_bytes` returns `0` when `(AttributeError, OSError, TypeError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure omlx/cluster/probe.py:207— `parse_linux_rdma_links` returns `{}` when `(TypeError, json.JSONDecodeError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure omlx/cluster/probe.py:305— `parse_thunderbolt_ports` returns `()` when `(TypeError, json.JSONDecodeError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure omlx/engine/vlm.py:3120— `_video_cache_key_ranges` returns `[]` when `(AttributeError, TypeError, ValueError, IndexError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure omlx/engine/vlm.py:1079— `matches` (in `_model_shard_matcher`) returns `False` when `(TypeError, OSError, RuntimeError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure omlx/engine_pool.py:187— `_positive_int` returns `0` when `(TypeError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure omlx/patches/mlx_vlm_glm5_next_compat/vendor/mlx_vlm/models/glm5_next/language.py:789— `_small_selector_ok` returns `False` when `(AttributeError, RuntimeError, TypeError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure omlx/prefill_helper/manager.py:724— `_load_speeds` returns `{}` when `(OSError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure omlx/process_memory_enforcer.py:1358— `_pool_bytes` returns `0` when `(TypeError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Hand-rolled JSON/XML parsing via regex omlx/patches/laguna/tool_parser.py:21— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Python code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex omlx/patches/laguna/tool_parser.py:22— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Python code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex omlx/patches/laguna/tool_parser.py:24— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Python code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex omlx/patches/deepseek_v41/encoding.py:47— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Python code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex omlx/api/thinking.py:27— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Python code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex omlx/api/thinking.py:30— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Python code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex omlx/api/tool_calling.py:610— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Python code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex omlx/api/tool_calling.py:1023— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Python code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex omlx/api/tool_calling.py:1024— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Python code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex omlx/api/tool_calling.py:1027— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Python code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex omlx/api/tool_calling.py:1074— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Python code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex omlx/api/tool_calling.py:1081— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Python code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex omlx/api/utils.py:1460— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Python code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex omlx/adapter/muse_glimmer.py:63— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Python code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex omlx/adapter/muse_glimmer.py:67— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Python code already uses a real parser in the same package; use it here too.
Orphaned file apps/omlx-mac/Sources/AppView/ViewModels/AccuracyBenchScreenVM.swift: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 apps/omlx-mac/Sources/AppView/ViewModels/StatusScreenVM.swift: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 omlx/eval/bbq.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 omlx/eval/mmlu_pro.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 omlx/eval/safetybench.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 omlx/eval/mathqa.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, 45 significant file(s) lose their only recent owner: omlx/patches/mlx_vlm_mtp/inkling_vlm_runtime.py, omlx/patches/qwen35_packed_linear.py, omlx/admin/hf_uploader.py, omlx/websearch.py, omlx/patches/mlx_lm_mtp/glm_moe_dsa_model.py, apps/omlx-mac/Sources/Updater/UpdateController.swift, omlx/exceptions.py, omlx/patches/gemma4_verify_kernel.py (+37 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 6 significant file(s) lose their only recent owner: omlx/cluster/node_role.py, omlx/cluster/enrollment.py, omlx/patches/minimax_m3_mlx_lm/minimax_m3_vl_model.py, omlx/patches/mlx_lm_pipeline_index.py, omlx/cluster/pipeline_smoke_worker.py, omlx/cluster/ssh_policy.py. Pair on, review, or document these before any departure.
X23 · Unguarded diagnostic materialisation· Diagnostic log message is built whether or not it is wanted · ×2
Diagnostic log message is built whether or not it is wanted omlx/cache/paged_ssd_cache.py:3191— `debug` at line 3191 is called with an argument built by `sorted(_READABLE_CACHE_FORMAT_VERSIONS)` (line 3195), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on.
Diagnostic log message is built whether or not it is wanted omlx/cache/vision_feature_cache.py:247— `debug` at line 247 is called with an argument built by `{ k : v for k, v in self._stats.items() if v > 0 }` (line 249), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on.
D16 · Bus Factor· Further sole-owners (lower concentration) · ×1
Further sole-owners (lower concentration) — 8 other contributor(s) are each the sole owner of a small amount of code below the off-boarding threshold — folded into the bus-factor score and metrics (61 single-owned of 541 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; 541 of the 631 production source files in this repository met that bar). They are anonymized user #3 (2 file(s)), anonymized user #4 (2 file(s)), anonymized user #5 (1 file(s)), anonymized user #6 (1 file(s)), anonymized user #7 (1 file(s)), anonymized user #8 (1 file(s)) (+2 more) — spread or document their files in the same way, at lower priority than the named off-boarding risks above. The files folded here: omlx/custom_kernels/nax_tiles.py, omlx/utils/layer_pipeline.py, omlx/patches/mlx_lm_mtp/context_copy.py, omlx/patches/module_cache.py, omlx/patches/mlx_lm_mtp/nemotron_h_model.py, omlx/patches/bailing_hybrid/swiglu_clamp.py, omlx/patches/mimo_v2/fused_qkv_layout.py, apps/omlx-mac/Scripts/check_custom_kernel_python_abi.py (+2 more).
No ADRs found — No ADRs found. No recognised ADR directory (`docs/adr/`, `docs/decisions/`, `adr/`, `docs/rfcs/`, an `ADR0001/` folder, or their siblings) exists anywhere in this tree. What was searched, so you can tell an empty log from a search that missed one: every directory under the tree (build output, dependencies and VCS metadata excepted), for a document that is either any non-index page inside a recognised ADR directory, whatever its name and however deeply nested (`docs/adr/use-postgres.md`, `docs/adr/2024/0001-x.md`); or a file anywhere whose name is ADR-shaped (`0001-use-postgres.md`, `adr-012-caching.md`); or, when neither turned anything up, a document carrying the decision-record signature (an "Architecture Decision Record" heading, or Status / Context / Decision / Consequences as section headings). A decision log that clears none of these — unnumbered files outside any recognised directory, without those headings — is not seen by this check and this row is then wrong. If that is your case, say so rather than renaming anything; otherwise, consider recording architectural decisions in `docs/adr/`.
D26 · Project Cohesion· Projects may be oversized for their cohesion · ×1
Projects may be oversized for their cohesion — 2 of 2 project(s) overshoot their size bounds, lowering Project Cohesion to 0.0/10. The most over is `(repository root)` (283995 LoC, 1773 module-visible types across 71 directories). Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
D34 · Knowledge Freshness· Orphaned files with no living knowledge · ×1
Orphaned files with no living knowledge — 6 of 541 analysed file(s) have no living knowledge left — their last meaningful change has decayed away, so if one breaks, no one currently understands it (counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 541 of the 631 production source files in this repository met that bar). None is large enough to earn a read-through of its own, so this row stands in for the per-file rows rather than raising one each — most significant first: apps/omlx-mac/Sources/AppView/ViewModels/AccuracyBenchScreenVM.swift, apps/omlx-mac/Sources/AppView/ViewModels/StatusScreenVM.swift, omlx/eval/bbq.py, omlx/eval/mmlu_pro.py, omlx/eval/safetybench.py, omlx/eval/mathqa.py. 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.
No ADRs — No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
No src/ separation — Production code isn't grouped under a src/ folder — it's spread across several top-level directories, so there's no one place that says 'this is the product'.
No SAST REDACTED:6— 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 14116 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner.
No release approval gate — The release is automated and no gate that pauses it for a human is DECLARED IN THIS REPOSITORY'S PIPELINE FILES. What was read: every file under `.github/workflows/`, `.forgejo/workflows/`, `.gitea/workflows/`, `.azuredevops/` and `.azure-pipelines/`, plus `.gitlab-ci*` and `azure-pipelines*` — with comment text stripped, so documenting a gate is not declaring one. What would have counted: GitLab's `when: manual`, CircleCI's `type: approval`, an Azure `ManualValidation@` task or an `approvals:` block, a Jenkins `input` step, a `uses:` step naming an approval action, an `environment:` paired with `reviewers` / `required_reviewers` / `protection` / `wait-timer` / `deployment_branch_policy`, a draft-release step, a `workflow_dispatch` promotion, or a release-event gate. ★ What this cannot see, because none of it is a file: a GitHub environment whose required reviewers are configured in repo SETTINGS, a branch protection rule, or an organisation deployment policy — all of them real, enforced gates that live outside the repository. If yours is one of those, this row is wrong and nothing in the tree could have told us. Otherwise: whatever the release trigger points at is published to users unreviewed, so a mistagged or unverified commit ships and the only remedy is a follow-up release.
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.)
X2 · Cancellation propagation· Not all async functions that make a request accept an AbortSignal · ×1
Not all async functions that make a request accept an AbortSignal — Only 10/108 async functions that make a cancellable request (fetch, axios, ky, ofetch, got, undici, node:http) accept an AbortSignal or pass one on, so a request keeps running after whatever wanted it has given up — a page navigated away from, an unmounted component, a timed-out job. Take a `signal` (or an options object that carries one) and hand it to the request; where nothing could ever cancel the call, omitting it is a deliberate choice — judge against how the function is used.
X5 · Nullable reference types· Ruby's type checker does not check nil everywhere · ×1
Ruby's type checker does not check nil everywhere — This repository commits no Sorbet configuration (`sorbet/config`) and no `Steepfile`, so nothing type-checks its 1 Ruby product file(s): a nilable value reaches a method call silently and raises `NoMethodError: undefined method … for nil` the first time it is nil. A `# typed:` sigil does nothing without a `sorbet/config` beside the code; a Steep run configured only on a command line is not something this check can read.
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.
none (dependency manifest found, not scanned for vulnerabilities here)
—
none (dependency manifest found, not scanned for vulnerabilities here): not applicable — Not scored — no dependency manifest in a supported ecosystem was read for this repository. A gap in the analyzer's language coverage, NOT a finding that the repository is free of vulnerable dependencies (a Python REDACTED/requirements.txt (pip/uv/Poetry) — not scanned yet).
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. semgrep could not parse 26 file(s) — `apps/omlx-mac/Sources/AppView/AppView.swift`, `apps/omlx-mac/Sources/AppView/Screens/AppearanceScreen.swift`, `apps/omlx-mac/Sources/AppView/Screens/ModelSettingsScreen.swift`, `apps/omlx-mac/Sources/AppView/Utils/LogRecords.swift`, `apps/omlx-mac/Sources/AppView/ViewModels/IntegrationsScreenVM.swift`, … (+21 more) — so the PII/GDPR sweep did not cover the unparsed regions of them; rows reported elsewhere in those files are real.
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.
none (dependency manifest found, not scanned for vulnerabilities here)
—
none (dependency manifest found, not scanned for vulnerabilities here): not applicable — Not scored — no dependency manifest in a supported ecosystem was read for this repository. A gap in the analyzer's language coverage, NOT a finding that the repository is free of vulnerable dependencies (a Python REDACTED/requirements.txt (pip/uv/Poetry) — not scanned yet).
0
—
Run 01a1a86d-c141-7cd4-a632-c16f51f97862 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 75 · Warnings: 2348 · Recommendations: 156 — Appendix A · all findings · full markdown report.
Generated by the Canine Code Analyzer: deterministic code-health analysis. 04-11-2026 @ 21:18 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.