Public report of ray-project/ray, published 25 October 2026. It has the same score, grades and number of
findings as the full report. The details of security findings (where they are in the code, which known
vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive reportMeasured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.10.5). Assert signed this survey and filed it in the standard's public register, where anyone can look it up by its survey ID. Check this survey →
Signed and filed in the standard's public register, 25 October 2026, 09:51 UTC · Survey ID cd_92d1500d44564a2da5daa4f22780a407
ray-project/ray
Measured 25 October 2026, 09:17 UTC, at code version 8d53e59
A regression is a drop of 0.5 points or more in the score, or of 2.5 or more out of 10 in a dimension, since the last survey.
Test reliability is not measured: The suite could not be re-run, but the repository declares tests of its own unreliable.
CAI scoreAt riskUp 3 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 very large codebase: 682,173 lines of product code in 376 projects, tests not counted · Estimated rebuild effort: about 7.7 person-years · Weakest lens: Production Readiness, 35
Findings by how serious they are
276 critical4279 serious634 minor
18 dimensions are left out of the score. For each one, Watchdog either couldn't measure it in this code, or found no evidence of the safeguard it looks for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.
This survey was produced by
Watchdog
Producer
Canine Development
Analyzer
Watchdog engine 1.0.0
Measured
25 October 2026, 09:17 UTC
A measurement, not a certificate. The Code Assurance Index records a number
together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee
the code. The standard was written by Canine Development, which also builds Watchdog. It is open to any tool that
implements it, and today Watchdog is the only one that does.
A critical security finding is open, such as a library with a known critical vulnerability or a password or key found in the code. The score itself is unchanged, but its band shows At risk until the finding is fixed. See the Security and Compliance lens.
The score is deterministic, which means the same code always gets the same score. Watchdog works it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸
87of 87 dimensions measured by tools.
5105of 5189 findings point to an exact file and line, so you can open each one in the code. The other 84 concern the repository as a whole, such as missing documentation.
87dimensions across 8 lenses, read from 682,173 lines of product code in 376 projects.
ray-project/ray is rated At risk because critical security findings are open, most of them in the packages it uses. Its score is held back in part because 15 passwords or keys sit in the current code. It scores 47 out of 100, which the At risk rating leaves unchanged.
Production Readiness, at 35, is the weakest lens and counts most in the score. The best first step is replacing the 15 exposed passwords or keys and switching the old ones off, worth about 10 points. Labelling the form fields and buttons comes next, worth about 4 points. Raising Production Readiness to 70 would lift the score to about 56.
136 known security holes in the packages the code depends on can be used by attackers. Fifty-two settings leave the servers or containers unsafe, and thirty-two parts of the code are no longer understood by anyone working on it. Updating the vulnerable packages, correcting the unsafe settings and having someone learn the forgotten files would close these risks. The 15 passwords or keys in the code and the 12 passwords or keys in the code's history need replacing, with the old ones switched off. The eight pipeline steps that run downloads without checking them need each download checked against a known checksum first. The four tests the project itself marks as unreliable need fixing or deleting.
The product code is 682,173 lines, about €1,100,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 Production Readiness rose from 35 to 70, the lowest score rated Strong, the score would rise from 47 to about 56.
Code composition: what the lines of code are
Product code 55%Tests 45%
New since the last survey: 164 findings
These 164 critical or serious findings weren't in the previous survey, on 11 October 2026. The first 100 are listed here, and the findings file in the download package lists them all.
Watchdog compares every finding with the previous survey's. A finding that has only moved to another line in the same file counts as the same finding, so only new findings appear here. Advisory notes from the AI model are left out, because the model words them afresh in every survey.
Fixed since the last survey: 146 findings
These 146 critical or serious findings were in the previous survey, on 11 October 2026, and are gone from this one. The first 100 are listed here.
€370,000 to €1,900,000, for 6,218 to 19,725 hours of work, about 7.7 person-years for 4 to 15 engineers
Difficulty of the problem
Standard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor
×0.7 at a score of 47. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
Size
Very large: 682,173 lines of product code
How the estimate is made: Watchdog prices the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.
Top priorities
The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.
1
Resolve the 15 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED (2), REDACTED (2), REDACTED.
Raises the score by about 10 points · Medium effort · REDACTED Scanning
2
Give every control a programmatic label (a <label for> / wrapping <label> / aria-label) and every button text — a placeholder is not a label.
Raises the score by about 4 points · Medium effort · Forms & labels
3
Enforce accessibility in the toolchain: add eslint-plugin-jsx-a11y, then assert with jest-axe in tests, then gate axe/pa11y/Lighthouse in CI.
Raises the score by about 3 points · Medium effort · A11y enforcement
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 €1,100,000 to build again, about 7.7 person-years of work. Its weakest lens is Production Readiness, at 35 (Weak). Production Readiness is about whether the product is ready to run in production and to change without breaking. Because the weakest lens counts most in the score, work on Production Readiness also moves the score most.
Based on: the rebuild estimate · the Production Readiness grade · how much each lens counts
What to do: Start with the Production Readiness actions in Top priorities.
If you do one thing first · First action
Resolve the 15 Leaked secret finding(s) in REDACTED Scanning. Of all the actions in this report, it raises the score most for the work it takes: about 10 points for medium effort, because it clears the 15 REDACTED 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
Architecture — module dependency graph
Project dependencies, layered top-to-bottom; arrows show direction. Any dashed red edge points upward or sideways — a layering smell or cycle. A clean layered graph has none.
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.
2462 modules, with 1030 dependencies between them. 3 loops run through 12 of the modules, marked above the diagonal.
The table shows the 40 modules with the most connections; 2422 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.
io.ray.api.runtime uses io.ray.api.function, so a change to io.ray.api.function can break io.ray.api.runtime, while a change to io.ray.api.runtime can't break io.ray.api.function.
Position
Below the diagonal: io.ray.api.runtime uses a module listed above it, which is the healthy direction.
io.ray.api.runtime uses io.ray.api.id, so a change to io.ray.api.id can break io.ray.api.runtime, while a change to io.ray.api.runtime can't break io.ray.api.id.
Position
Below the diagonal: io.ray.api.runtime uses a module listed above it, which is the healthy direction.
io.ray.api.runtime uses io.ray.api.options, so a change to io.ray.api.options can break io.ray.api.runtime, while a change to io.ray.api.runtime can't break io.ray.api.options.
Position
Below the diagonal: io.ray.api.runtime uses a module listed above it, which is the healthy direction.
18→24 io.ray.api.runtime uses io.ray.apipart of a loop✕
Connections
6 pairs of types, where a type in io.ray.api.runtime uses a type in io.ray.api.
io.ray.api.runtime uses io.ray.api, so a change to io.ray.api can break io.ray.api.runtime, while a change to io.ray.api.runtime can't break io.ray.api.
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.
python.ray._private.runtime_env.plugin uses python.ray._private.runtime_env.context, so a change to python.ray._private.runtime_env.context can break python.ray._private.runtime_env.plugin, while a change to python.ray._private.runtime_env.plugin can't break python.ray._private.runtime_env.context.
Position
Below the diagonal: python.ray._private.runtime_env.plugin uses a module listed above it, which is the healthy direction.
python.ray.data._internal.execution.interfaces.ref_bundle uses python.ray.data.block, so a change to python.ray.data.block can break python.ray.data._internal.execution.interfaces.ref_bundle, while a change to python.ray.data._internal.execution.interfaces.ref_bundle can't break python.ray.data.block.
Position
Below the diagonal: python.ray.data._internal.execution.interfaces.ref_bundle uses a module listed above it, which is the healthy direction.
python.ray.data._internal.logical.interfaces.logical_operator uses python.ray.data.expressions, so a change to python.ray.data.expressions can break python.ray.data._internal.logical.interfaces.logical_operator, while a change to python.ray.data._internal.logical.interfaces.logical_operator can't break python.ray.data.expressions.
Position
Below the diagonal: python.ray.data._internal.logical.interfaces.logical_operator uses a module listed above it, which is the healthy direction.
python.ray.data.datasource.datasink uses python.ray.data._internal.execution.interfaces.task_context, so a change to python.ray.data._internal.execution.interfaces.task_context can break python.ray.data.datasource.datasink, while a change to python.ray.data.datasource.datasink can't break python.ray.data._internal.execution.interfaces.task_context.
Position
Below the diagonal: python.ray.data.datasource.datasink uses a module listed above it, which is the healthy direction.
python.ray.data.datasource.datasource uses python.ray.data.block, so a change to python.ray.data.block can break python.ray.data.datasource.datasource, while a change to python.ray.data.datasource.datasource can't break python.ray.data.block.
Position
Below the diagonal: python.ray.data.datasource.datasource uses a module listed above it, which is the healthy direction.
python.ray.data.datasource.datasource uses python.ray.data.expressions, so a change to python.ray.data.expressions can break python.ray.data.datasource.datasource, while a change to python.ray.data.datasource.datasource can't break python.ray.data.expressions.
Position
Below the diagonal: python.ray.data.datasource.datasource uses a module listed above it, which is the healthy direction.
32 pairs of types, where a type in io.ray.api uses a type in io.ray.api.function. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
io.ray.api uses io.ray.api.function, so a change to io.ray.api.function can break io.ray.api, while a change to io.ray.api can't break io.ray.api.function.
Position
Below the diagonal: io.ray.api uses a module listed above it, which is the healthy direction.
io.ray.api uses io.ray.api.options, so a change to io.ray.api.options can break io.ray.api, while a change to io.ray.api can't break io.ray.api.options.
Position
Below the diagonal: io.ray.api uses a module listed above it, which is the healthy direction.
io.ray.api uses io.ray.api.runtime, so a change to io.ray.api.runtime can break io.ray.api, while a change to io.ray.api can't break io.ray.api.runtime.
Position
Below the diagonal: io.ray.api uses a module listed above it, which is the healthy direction.
python.ray.data._internal uses python.ray.data.block, so a change to python.ray.data.block can break python.ray.data._internal, while a change to python.ray.data._internal can't break python.ray.data.block.
Position
Below the diagonal: python.ray.data._internal uses a module listed above it, which is the healthy direction.
python.ray.data._internal uses python.ray.data.context, so a change to python.ray.data.context can break python.ray.data._internal, while a change to python.ray.data._internal can't break python.ray.data.context.
Position
Below the diagonal: python.ray.data._internal uses a module listed above it, which is the healthy direction.
python.ray.data._internal uses python.ray.data._internal.execution.interfaces.ref_bundle, so a change to python.ray.data._internal.execution.interfaces.ref_bundle can break python.ray.data._internal, while a change to python.ray.data._internal can't break python.ray.data._internal.execution.interfaces.ref_bundle.
Position
Below the diagonal: python.ray.data._internal uses a module listed above it, which is the healthy direction.
python.ray.data._internal.datasource uses python.ray.data.block, so a change to python.ray.data.block can break python.ray.data._internal.datasource, while a change to python.ray.data._internal.datasource can't break python.ray.data.block.
Position
Below the diagonal: python.ray.data._internal.datasource uses a module listed above it, which is the healthy direction.
python.ray.data._internal.datasource uses python.ray.data.datasource.datasource, so a change to python.ray.data.datasource.datasource can break python.ray.data._internal.datasource, while a change to python.ray.data._internal.datasource can't break python.ray.data.datasource.datasource.
Position
Below the diagonal: python.ray.data._internal.datasource uses a module listed above it, which is the healthy direction.
3 pairs of types, where a type in python.ray.data._internal.execution.interfaces.physical_operator uses a type in python.ray.data._internal.execution.interfaces.execution_options.
python.ray.data._internal.execution.interfaces.physical_operator uses python.ray.data._internal.execution.interfaces.execution_options, so a change to python.ray.data._internal.execution.interfaces.execution_options can break python.ray.data._internal.execution.interfaces.physical_operator, while a change to python.ray.data._internal.execution.interfaces.physical_operator can't break python.ray.data._internal.execution.interfaces.execution_options.
Position
Below the diagonal: python.ray.data._internal.execution.interfaces.physical_operator uses a module listed above it, which is the healthy direction.
python.ray.data._internal.execution.interfaces.physical_operator uses python.ray.data._internal.stats, so a change to python.ray.data._internal.stats can break python.ray.data._internal.execution.interfaces.physical_operator, while a change to python.ray.data._internal.execution.interfaces.physical_operator can't break python.ray.data._internal.stats.
Position
Below the diagonal: python.ray.data._internal.execution.interfaces.physical_operator uses a module listed above it, which is the healthy direction.
python.ray.data._internal.execution.interfaces.physical_operator uses python.ray.data.context, so a change to python.ray.data.context can break python.ray.data._internal.execution.interfaces.physical_operator, while a change to python.ray.data._internal.execution.interfaces.physical_operator can't break python.ray.data.context.
Position
Below the diagonal: python.ray.data._internal.execution.interfaces.physical_operator uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in python.ray.data._internal.execution.interfaces.physical_operator uses a type in python.ray.data._internal.execution.interfaces.ref_bundle.
python.ray.data._internal.execution.interfaces.physical_operator uses python.ray.data._internal.execution.interfaces.ref_bundle, so a change to python.ray.data._internal.execution.interfaces.ref_bundle can break python.ray.data._internal.execution.interfaces.physical_operator, while a change to python.ray.data._internal.execution.interfaces.physical_operator can't break python.ray.data._internal.execution.interfaces.ref_bundle.
Position
Below the diagonal: python.ray.data._internal.execution.interfaces.physical_operator uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in python.ray.data._internal.logical.interfaces.logical_plan uses a type in python.ray.data._internal.logical.interfaces.logical_operator.
python.ray.data._internal.logical.interfaces.logical_plan uses python.ray.data._internal.logical.interfaces.logical_operator, so a change to python.ray.data._internal.logical.interfaces.logical_operator can break python.ray.data._internal.logical.interfaces.logical_plan, while a change to python.ray.data._internal.logical.interfaces.logical_plan can't break python.ray.data._internal.logical.interfaces.logical_operator.
Position
Below the diagonal: python.ray.data._internal.logical.interfaces.logical_plan uses a module listed above it, which is the healthy direction.
python.ray.data._internal.logical.operators.read_operator uses python.ray.data.block, so a change to python.ray.data.block can break python.ray.data._internal.logical.operators.read_operator, while a change to python.ray.data._internal.logical.operators.read_operator can't break python.ray.data.block.
Position
Below the diagonal: python.ray.data._internal.logical.operators.read_operator uses a module listed above it, which is the healthy direction.
python.ray.data._internal.logical.operators.read_operator uses python.ray.data.expressions, so a change to python.ray.data.expressions can break python.ray.data._internal.logical.operators.read_operator, while a change to python.ray.data._internal.logical.operators.read_operator can't break python.ray.data.expressions.
Position
Below the diagonal: python.ray.data._internal.logical.operators.read_operator uses a module listed above it, which is the healthy direction.
6 pairs of types, where a type in python.ray.data._internal.logical.operators.read_operator uses a type in python.ray.data._internal.logical.interfaces.logical_operator.
python.ray.data._internal.logical.operators.read_operator uses python.ray.data._internal.logical.interfaces.logical_operator, so a change to python.ray.data._internal.logical.interfaces.logical_operator can break python.ray.data._internal.logical.operators.read_operator, while a change to python.ray.data._internal.logical.operators.read_operator can't break python.ray.data._internal.logical.interfaces.logical_operator.
Position
Below the diagonal: python.ray.data._internal.logical.operators.read_operator uses a module listed above it, which is the healthy direction.
python.ray.data._internal.logical.operators.read_operator uses python.ray.data.datasource.datasource, so a change to python.ray.data.datasource.datasource can break python.ray.data._internal.logical.operators.read_operator, while a change to python.ray.data._internal.logical.operators.read_operator can't break python.ray.data.datasource.datasource.
Position
Below the diagonal: python.ray.data._internal.logical.operators.read_operator uses a module listed above it, which is the healthy direction.
python.ray.data.datasource.file_based_datasource uses python.ray.data.datasource.datasource, so a change to python.ray.data.datasource.datasource can break python.ray.data.datasource.file_based_datasource, while a change to python.ray.data.datasource.file_based_datasource can't break python.ray.data.datasource.datasource.
Position
Below the diagonal: python.ray.data.datasource.file_based_datasource uses a module listed above it, which is the healthy direction.
python.ray.data.datasource.file_datasink uses python.ray.data._internal.execution.interfaces.task_context, so a change to python.ray.data._internal.execution.interfaces.task_context can break python.ray.data.datasource.file_datasink, while a change to python.ray.data.datasource.file_datasink can't break python.ray.data._internal.execution.interfaces.task_context.
Position
Below the diagonal: python.ray.data.datasource.file_datasink uses a module listed above it, which is the healthy direction.
python.ray.data.datasource.file_datasink uses python.ray.data.block, so a change to python.ray.data.block can break python.ray.data.datasource.file_datasink, while a change to python.ray.data.datasource.file_datasink can't break python.ray.data.block.
Position
Below the diagonal: python.ray.data.datasource.file_datasink uses a module listed above it, which is the healthy direction.
python.ray.data.datasource.file_datasink uses python.ray.data.datasource.datasink, so a change to python.ray.data.datasource.datasink can break python.ray.data.datasource.file_datasink, while a change to python.ray.data.datasource.file_datasink can't break python.ray.data.datasource.datasink.
Position
Below the diagonal: python.ray.data.datasource.file_datasink uses a module listed above it, which is the healthy direction.
io.ray.runtime uses io.ray.api.function, so a change to io.ray.api.function can break io.ray.runtime, while a change to io.ray.runtime can't break io.ray.api.function.
Position
Below the diagonal: io.ray.runtime uses a module listed above it, which is the healthy direction.
io.ray.runtime uses io.ray.api.options, so a change to io.ray.api.options can break io.ray.runtime, while a change to io.ray.runtime can't break io.ray.api.options.
Position
Below the diagonal: io.ray.runtime uses a module listed above it, which is the healthy direction.
io.ray.runtime uses io.ray.api.runtime, so a change to io.ray.api.runtime can break io.ray.runtime, while a change to io.ray.runtime can't break io.ray.api.runtime.
Position
Below the diagonal: io.ray.runtime uses a module listed above it, which is the healthy direction.
python.ray.data._internal.execution uses python.ray.data._internal.execution.interfaces.execution_options, so a change to python.ray.data._internal.execution.interfaces.execution_options can break python.ray.data._internal.execution, while a change to python.ray.data._internal.execution can't break python.ray.data._internal.execution.interfaces.execution_options.
Position
Below the diagonal: python.ray.data._internal.execution uses a module listed above it, which is the healthy direction.
python.ray.data._internal.execution uses python.ray.data.context, so a change to python.ray.data.context can break python.ray.data._internal.execution, while a change to python.ray.data._internal.execution can't break python.ray.data.context.
Position
Below the diagonal: python.ray.data._internal.execution uses a module listed above it, which is the healthy direction.
python.ray.data._internal.execution uses python.ray.data._internal.execution.interfaces.physical_operator, so a change to python.ray.data._internal.execution.interfaces.physical_operator can break python.ray.data._internal.execution, while a change to python.ray.data._internal.execution can't break python.ray.data._internal.execution.interfaces.physical_operator.
Position
Below the diagonal: python.ray.data._internal.execution uses a module listed above it, which is the healthy direction.
python.ray.data._internal.execution.operators.base_physical_operator uses python.ray.data.context, so a change to python.ray.data.context can break python.ray.data._internal.execution.operators.base_physical_operator, while a change to python.ray.data._internal.execution.operators.base_physical_operator can't break python.ray.data.context.
Position
Below the diagonal: python.ray.data._internal.execution.operators.base_physical_operator uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in python.ray.data._internal.execution.operators.base_physical_operator uses a type in python.ray.data._internal.execution.interfaces.ref_bundle.
python.ray.data._internal.execution.operators.base_physical_operator uses python.ray.data._internal.execution.interfaces.ref_bundle, so a change to python.ray.data._internal.execution.interfaces.ref_bundle can break python.ray.data._internal.execution.operators.base_physical_operator, while a change to python.ray.data._internal.execution.operators.base_physical_operator can't break python.ray.data._internal.execution.interfaces.ref_bundle.
Position
Below the diagonal: python.ray.data._internal.execution.operators.base_physical_operator uses a module listed above it, which is the healthy direction.
3 pairs of types, where a type in python.ray.data._internal.execution.operators.base_physical_operator uses a type in python.ray.data._internal.execution.interfaces.physical_operator.
python.ray.data._internal.execution.operators.base_physical_operator uses python.ray.data._internal.execution.interfaces.physical_operator, so a change to python.ray.data._internal.execution.interfaces.physical_operator can break python.ray.data._internal.execution.operators.base_physical_operator, while a change to python.ray.data._internal.execution.operators.base_physical_operator can't break python.ray.data._internal.execution.interfaces.physical_operator.
Position
Below the diagonal: python.ray.data._internal.execution.operators.base_physical_operator uses a module listed above it, which is the healthy direction.
3 pairs of types, where a type in python.ray.data._internal.execution.operators.hash_shuffle uses a type in python.ray.data._internal.execution.interfaces.execution_options.
python.ray.data._internal.execution.operators.hash_shuffle uses python.ray.data._internal.execution.interfaces.execution_options, so a change to python.ray.data._internal.execution.interfaces.execution_options can break python.ray.data._internal.execution.operators.hash_shuffle, while a change to python.ray.data._internal.execution.operators.hash_shuffle can't break python.ray.data._internal.execution.interfaces.execution_options.
Position
Below the diagonal: python.ray.data._internal.execution.operators.hash_shuffle uses a module listed above it, which is the healthy direction.
python.ray.data._internal.execution.operators.hash_shuffle uses python.ray.data.block, so a change to python.ray.data.block can break python.ray.data._internal.execution.operators.hash_shuffle, while a change to python.ray.data._internal.execution.operators.hash_shuffle can't break python.ray.data.block.
Position
Below the diagonal: python.ray.data._internal.execution.operators.hash_shuffle uses a module listed above it, which is the healthy direction.
python.ray.data._internal.execution.operators.hash_shuffle uses python.ray.data.context, so a change to python.ray.data.context can break python.ray.data._internal.execution.operators.hash_shuffle, while a change to python.ray.data._internal.execution.operators.hash_shuffle can't break python.ray.data.context.
Position
Below the diagonal: python.ray.data._internal.execution.operators.hash_shuffle uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in python.ray.data._internal.execution.operators.hash_shuffle uses a type in python.ray.data._internal.execution.interfaces.ref_bundle.
python.ray.data._internal.execution.operators.hash_shuffle uses python.ray.data._internal.execution.interfaces.ref_bundle, so a change to python.ray.data._internal.execution.interfaces.ref_bundle can break python.ray.data._internal.execution.operators.hash_shuffle, while a change to python.ray.data._internal.execution.operators.hash_shuffle can't break python.ray.data._internal.execution.interfaces.ref_bundle.
Position
Below the diagonal: python.ray.data._internal.execution.operators.hash_shuffle uses a module listed above it, which is the healthy direction.
2 pairs of types, where a type in python.ray.data._internal.execution.operators.hash_shuffle uses a type in python.ray.data._internal.execution.interfaces.physical_operator.
python.ray.data._internal.execution.operators.hash_shuffle uses python.ray.data._internal.execution.interfaces.physical_operator, so a change to python.ray.data._internal.execution.interfaces.physical_operator can break python.ray.data._internal.execution.operators.hash_shuffle, while a change to python.ray.data._internal.execution.operators.hash_shuffle can't break python.ray.data._internal.execution.interfaces.physical_operator.
Position
Below the diagonal: python.ray.data._internal.execution.operators.hash_shuffle uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in python.ray.data._internal.execution.operators.map_operator uses a type in python.ray.data._internal.execution.interfaces.execution_options.
python.ray.data._internal.execution.operators.map_operator uses python.ray.data._internal.execution.interfaces.execution_options, so a change to python.ray.data._internal.execution.interfaces.execution_options can break python.ray.data._internal.execution.operators.map_operator, while a change to python.ray.data._internal.execution.operators.map_operator can't break python.ray.data._internal.execution.interfaces.execution_options.
Position
Below the diagonal: python.ray.data._internal.execution.operators.map_operator uses a module listed above it, which is the healthy direction.
python.ray.data._internal.execution.operators.map_operator uses python.ray.data.context, so a change to python.ray.data.context can break python.ray.data._internal.execution.operators.map_operator, while a change to python.ray.data._internal.execution.operators.map_operator can't break python.ray.data.context.
Position
Below the diagonal: python.ray.data._internal.execution.operators.map_operator uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in python.ray.data._internal.execution.operators.map_operator uses a type in python.ray.data._internal.execution.interfaces.ref_bundle.
python.ray.data._internal.execution.operators.map_operator uses python.ray.data._internal.execution.interfaces.ref_bundle, so a change to python.ray.data._internal.execution.interfaces.ref_bundle can break python.ray.data._internal.execution.operators.map_operator, while a change to python.ray.data._internal.execution.operators.map_operator can't break python.ray.data._internal.execution.interfaces.ref_bundle.
Position
Below the diagonal: python.ray.data._internal.execution.operators.map_operator uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in python.ray.data._internal.execution.operators.map_operator uses a type in python.ray.data._internal.execution.interfaces.physical_operator.
python.ray.data._internal.execution.operators.map_operator uses python.ray.data._internal.execution.interfaces.physical_operator, so a change to python.ray.data._internal.execution.interfaces.physical_operator can break python.ray.data._internal.execution.operators.map_operator, while a change to python.ray.data._internal.execution.operators.map_operator can't break python.ray.data._internal.execution.interfaces.physical_operator.
Position
Below the diagonal: python.ray.data._internal.execution.operators.map_operator uses a module listed above it, which is the healthy direction.
python.ray.data.dataset uses python.ray.data._internal.stats, so a change to python.ray.data._internal.stats can break python.ray.data.dataset, while a change to python.ray.data.dataset can't break python.ray.data._internal.stats.
Position
Below the diagonal: python.ray.data.dataset uses a module listed above it, which is the healthy direction.
python.ray.data.dataset uses python.ray.data.context, so a change to python.ray.data.context can break python.ray.data.dataset, while a change to python.ray.data.dataset can't break python.ray.data.context.
Position
Below the diagonal: python.ray.data.dataset uses a module listed above it, which is the healthy direction.
python.ray.data.dataset uses python.ray.data.expressions, so a change to python.ray.data.expressions can break python.ray.data.dataset, while a change to python.ray.data.dataset can't break python.ray.data.expressions.
Position
Below the diagonal: python.ray.data.dataset uses a module listed above it, which is the healthy direction.
python.ray.data.dataset uses python.ray.data._internal.execution.interfaces.ref_bundle, so a change to python.ray.data._internal.execution.interfaces.ref_bundle can break python.ray.data.dataset, while a change to python.ray.data.dataset can't break python.ray.data._internal.execution.interfaces.ref_bundle.
Position
Below the diagonal: python.ray.data.dataset uses a module listed above it, which is the healthy direction.
python.ray.data.dataset uses python.ray.data.datasource.datasink, so a change to python.ray.data.datasource.datasink can break python.ray.data.dataset, while a change to python.ray.data.dataset can't break python.ray.data.datasource.datasink.
Position
Below the diagonal: python.ray.data.dataset uses a module listed above it, which is the healthy direction.
python.ray.data.dataset uses python.ray.data._internal.logical.interfaces.logical_plan, so a change to python.ray.data._internal.logical.interfaces.logical_plan can break python.ray.data.dataset, while a change to python.ray.data.dataset can't break python.ray.data._internal.logical.interfaces.logical_plan.
Position
Below the diagonal: python.ray.data.dataset uses a module listed above it, which is the healthy direction.
python.ray.data uses python.ray.data.context, so a change to python.ray.data.context can break python.ray.data, while a change to python.ray.data can't break python.ray.data.context.
Position
Below the diagonal: python.ray.data uses a module listed above it, which is the healthy direction.
python.ray.data uses python.ray.data.expressions, so a change to python.ray.data.expressions can break python.ray.data, while a change to python.ray.data can't break python.ray.data.expressions.
Position
Below the diagonal: python.ray.data uses a module listed above it, which is the healthy direction.
python.ray.data uses python.ray.data.datasource.datasource, so a change to python.ray.data.datasource.datasource can break python.ray.data, while a change to python.ray.data can't break python.ray.data.datasource.datasource.
Position
Below the diagonal: python.ray.data uses a module listed above it, which is the healthy direction.
python.ray.data uses python.ray.data.dataset, so a change to python.ray.data.dataset can break python.ray.data, while a change to python.ray.data can't break python.ray.data.dataset.
Position
Below the diagonal: python.ray.data uses a module listed above it, which is the healthy direction.
3 pairs of types, where a type in python.ray.data._internal.execution.operators.actor_pool_map_operator uses a type in python.ray.data._internal.execution.interfaces.execution_options.
python.ray.data._internal.execution.operators.actor_pool_map_operator uses python.ray.data._internal.execution.interfaces.execution_options, so a change to python.ray.data._internal.execution.interfaces.execution_options can break python.ray.data._internal.execution.operators.actor_pool_map_operator, while a change to python.ray.data._internal.execution.operators.actor_pool_map_operator can't break python.ray.data._internal.execution.interfaces.execution_options.
Position
Below the diagonal: python.ray.data._internal.execution.operators.actor_pool_map_operator uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in python.ray.data._internal.execution.operators.actor_pool_map_operator uses a type in python.ray.data._internal.execution.interfaces.task_context.
python.ray.data._internal.execution.operators.actor_pool_map_operator uses python.ray.data._internal.execution.interfaces.task_context, so a change to python.ray.data._internal.execution.interfaces.task_context can break python.ray.data._internal.execution.operators.actor_pool_map_operator, while a change to python.ray.data._internal.execution.operators.actor_pool_map_operator can't break python.ray.data._internal.execution.interfaces.task_context.
Position
Below the diagonal: python.ray.data._internal.execution.operators.actor_pool_map_operator uses a module listed above it, which is the healthy direction.
python.ray.data._internal.execution.operators.actor_pool_map_operator uses python.ray.data.context, so a change to python.ray.data.context can break python.ray.data._internal.execution.operators.actor_pool_map_operator, while a change to python.ray.data._internal.execution.operators.actor_pool_map_operator can't break python.ray.data.context.
Position
Below the diagonal: python.ray.data._internal.execution.operators.actor_pool_map_operator uses a module listed above it, which is the healthy direction.
2 pairs of types, where a type in python.ray.data._internal.execution.operators.actor_pool_map_operator uses a type in python.ray.data._internal.execution.interfaces.ref_bundle.
python.ray.data._internal.execution.operators.actor_pool_map_operator uses python.ray.data._internal.execution.interfaces.ref_bundle, so a change to python.ray.data._internal.execution.interfaces.ref_bundle can break python.ray.data._internal.execution.operators.actor_pool_map_operator, while a change to python.ray.data._internal.execution.operators.actor_pool_map_operator can't break python.ray.data._internal.execution.interfaces.ref_bundle.
Position
Below the diagonal: python.ray.data._internal.execution.operators.actor_pool_map_operator uses a module listed above it, which is the healthy direction.
2 pairs of types, where a type in python.ray.data._internal.execution.operators.actor_pool_map_operator uses a type in python.ray.data._internal.execution.interfaces.physical_operator.
python.ray.data._internal.execution.operators.actor_pool_map_operator uses python.ray.data._internal.execution.interfaces.physical_operator, so a change to python.ray.data._internal.execution.interfaces.physical_operator can break python.ray.data._internal.execution.operators.actor_pool_map_operator, while a change to python.ray.data._internal.execution.operators.actor_pool_map_operator can't break python.ray.data._internal.execution.interfaces.physical_operator.
Position
Below the diagonal: python.ray.data._internal.execution.operators.actor_pool_map_operator uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in python.ray.data._internal.execution.operators.actor_pool_map_operator uses a type in python.ray.data._internal.execution.operators.map_operator.
python.ray.data._internal.execution.operators.actor_pool_map_operator uses python.ray.data._internal.execution.operators.map_operator, so a change to python.ray.data._internal.execution.operators.map_operator can break python.ray.data._internal.execution.operators.actor_pool_map_operator, while a change to python.ray.data._internal.execution.operators.actor_pool_map_operator can't break python.ray.data._internal.execution.operators.map_operator.
Position
Below the diagonal: python.ray.data._internal.execution.operators.actor_pool_map_operator uses a module listed above it, which is the healthy direction.
python.ray.data._internal.planner uses python.ray.data.block, so a change to python.ray.data.block can break python.ray.data._internal.planner, while a change to python.ray.data._internal.planner can't break python.ray.data.block.
Position
Below the diagonal: python.ray.data._internal.planner uses a module listed above it, which is the healthy direction.
python.ray.data._internal.planner uses python.ray.data.context, so a change to python.ray.data.context can break python.ray.data._internal.planner, while a change to python.ray.data._internal.planner can't break python.ray.data.context.
Position
Below the diagonal: python.ray.data._internal.planner uses a module listed above it, which is the healthy direction.
python.ray.data._internal.planner uses python.ray.data._internal.logical.interfaces.logical_operator, so a change to python.ray.data._internal.logical.interfaces.logical_operator can break python.ray.data._internal.planner, while a change to python.ray.data._internal.planner can't break python.ray.data._internal.logical.interfaces.logical_operator.
Position
Below the diagonal: python.ray.data._internal.planner uses a module listed above it, which is the healthy direction.
python.ray.data._internal.planner uses python.ray.data.datasource.datasource, so a change to python.ray.data.datasource.datasource can break python.ray.data._internal.planner, while a change to python.ray.data._internal.planner can't break python.ray.data.datasource.datasource.
Position
Below the diagonal: python.ray.data._internal.planner uses a module listed above it, which is the healthy direction.
python.ray.data._internal.planner uses python.ray.data._internal.execution.interfaces.physical_operator, so a change to python.ray.data._internal.execution.interfaces.physical_operator can break python.ray.data._internal.planner, while a change to python.ray.data._internal.planner can't break python.ray.data._internal.execution.interfaces.physical_operator.
Position
Below the diagonal: python.ray.data._internal.planner uses a module listed above it, which is the healthy direction.
python.ray.data._internal.planner uses python.ray.data._internal.logical.operators.read_operator, so a change to python.ray.data._internal.logical.operators.read_operator can break python.ray.data._internal.planner, while a change to python.ray.data._internal.planner can't break python.ray.data._internal.logical.operators.read_operator.
Position
Below the diagonal: python.ray.data._internal.planner uses a module listed above it, which is the healthy direction.
python.ray.data._internal.planner uses python.ray.data._internal.execution.operators.map_operator, so a change to python.ray.data._internal.execution.operators.map_operator can break python.ray.data._internal.planner, while a change to python.ray.data._internal.planner can't break python.ray.data._internal.execution.operators.map_operator.
Position
Below the diagonal: python.ray.data._internal.planner uses a module listed above it, which is the healthy direction.
At a glance — Code Health · 60% · Adequate · gated by X4 ·
Findings mapped to OWASP categories; the specific CVEs/secrets are in the Security dimension cards below and findings.md (redacted only on the public version of this report).
OWASP category
Findings
Severity
A05:2025 — Injection
266
High / Critical
A03:2025 — Software Supply Chain Failures
203
High / Critical
A02:2025 — Security Misconfiguration
133
High / Critical
A07:2025 — Authentication Failures
28
High / Critical
Roadmap
Immediately resolve the 15 leaked secrets in configuration and script files to secure the codebase. Simultaneously, enforce accessibility by adding programmatic labels to all controls and buttons, while integrating SAST tooling into CI to prevent security regressions. Finally, harden outbound HTTP calls with timeouts, retries, and circuit breakers to ensure system resilience.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Resolve the 15 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED (2), REDACTED (2), REDACTED.
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.
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.
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.
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 — 276
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 — 4279
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 — 634
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 18
Something this survey could not settle
from the outside, and which could be critical or serious. Either a control was required and no
positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves
nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean
result. These are excluded from the score rather than awarded a pass, so the number on the cover neither
rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each
one is named under Limitations.
Methodology & how to trust this report
Watchdog is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. 87 of 87 evaluated dimensions are computed purely by tools and static analysis (confidence 1.0); none rely on LLM judgement. Overall confidence is 0.8 — the weighted average across measured dimensions; it falls as more of the score leans on LLM-assisted judgement and rises when it's fully tool-backed.
Every figure here is one of three kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact; ◐ Advisory — an LLM prose judgement. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10; ◐ Sampled · advisory marks an LLM verdict over a bounded sample — advisory, never a deterministic measurement.
What we checked — 87 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, 5105 of 5189 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, a scanner, or (for a handful of documentation/naming dimensions) an LLM labelled sampled · advisory — 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.
D4 Code Duplication — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. The 578 duplicated block group(s) on this row were found in the languages this pass could tokenize, and they do NOT cover all of this repository's production source: .cc (141,749 lines, 17% of production source) went unread, because no language model this pass could load exposed a clone-unit token stream for those file kinds. Duplication in that source is UNMEASURED — its absence from the count above is a gap in this analyzer's language coverage, not a finding that the code is free of duplication.
D8 Code Coverage — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT MEASURED: test source is present (.py, .tsx, .java, .js, .ts) 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 — `vitest --coverage`, `jest --coverage`, `bun test --coverage --coverage-reporter=lcov`, or `nyc`, or JaCoCo XML — `mvn jacoco:report` or the Gradle `jacocoTestReport` task) 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 — `vitest --coverage`, `jest --coverage`, `bun test --coverage --coverage-reporter=lcov`, or `nyc`, or JaCoCo XML — `mvn jacoco:report` or the Gradle `jacocoTestReport` task) 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 — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. The 123 test(s) behind this row are the ones the JavaScript/TypeScript census could read, and this repository also carries at least 1,897 test source file(s) (.py, .java) 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 — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This repository declares 4 of its own test(s) unreliable. The built-in reliability runner does not support this repository's ecosystem (.py, .tsx, .java, .js, .ts), so the suite was not re-run and no reliability score is given — these are the repository's own declarations, not our measurement.
D12 Dependency Hygiene — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Not scored — 1 Maven/Gradle manifest(s) were read, stating a version for 0 dependency(ies) and leaving 0 to a parent or an imported BOM, but no build resolved the dependency graph, so the outdated signal was not established. NOT a finding that these dependencies are current or healthy.
D14 License Compliance — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Not scored — this repository's Python dependency closure is larger than this pass walks (the dependency closure exceeded 500 distributions), so only part of it was read, and a licence verdict over part of a dependency graph is not a licence verdict. Nothing is asserted about this repository's licensing in either direction.
D19 Documentation Quality — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each ecosystem's manifests (what makes a folder runnable or a published package) need their own proof before D19 judges its units. Until then those folders' READMEs are judged only as documents (boilerplate, structure), never counted as complete.
D19 Documentation Quality — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This kind did not reach the 95 % precision gate in three adjudicated runs (docs/plans/deterministic-engine/adjudication/D19-sample3-v3.md), so by the pre-registered fallback it publishes no row until a re-measurement shows it does. The candidates are counted here, not reported as findings, and the score does not include them.
D21 Naming Consistency — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D21's deterministic naming rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. Until then its declarations carry no naming verdict this run — this says nothing about whether its names are consistent.
D22 Internal API Consistency — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22's deterministic call-shape rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. This says nothing about whether that surface is consistent.
D24 Comment Value — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover the language this repository's product is written in, so it had nothing of the product to read. That is a gap in this analyzer's language reach — not a finding about this repository.
D26 Project Cohesion — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Project size and spread are measured over build units whose source a code model reads. This repository's .cc source is a material share of its production lines and was read by none, so the score is a verdict about the units that were read. Not a finding that the unread source is cohesive — it is unmeasured.
D27 Navigability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Navigability is taken over call sites whose callee resolved. For C# that population includes calls into referenced assemblies; for this language only calls declared inside the repository count, so the abstention threshold reads the repository's use of its standard library as a resolution failure. That is a limit of this analyzer, not a build problem in this repository.
D31 IaC & Container Security — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Python/ray/tests/project_files/docker_project/Dockerfile carries no `FROM` instruction, so it declares no build stage and every REDACTED rule this engine owns — the runtime-hardening, key-material, mutable-clone, no-op-shim, build-context, trust-anchor, install-guard, setuid and world-writable-path rules — is outside its own premise there and returned nothing. That silence is deliberate and correct: with no base image there is no image to reason about. It is reported here because it is NOT the same fact as a clean file, and coverage is stated as 64 of 65 Infrastructure-as-Code manifest(s) fully judged rather than as 100%. The vendor scanners (trivy, checkov) do read these files and their findings above stand; only this engine's own stage-keyed rules are absent. No owner action: a build file with no FROM is a legitimate include fragment.
D32 Data Compliance (PII/GDPR) — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `python/ray/dashboard/client/public/speedscope-1.5.3/speedscope.75eb7d8e.js` 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.
D41 Kernel & Syscall Confinement — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Python/ray/autoscaler/kuberay/ray-cluster.complete.yaml:4 did not read as a pod spec (a templated manifest such as Helm's that is not YAML until rendered, or a workload whose pod spec this check does not locate), so the seccomp/AppArmor profile in force there was not judged and no row about them can appear on this card.
AX1 Captive dependencies — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads Microsoft.Extensions.DependencyInjection 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 — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Render strategy: boot via DevServer (start). the dev server did not expose a crawlable HTTP endpoint in time — no runtime evidence.
C1 Data Protection — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These personal data controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks personal data controls.
C3 Audit Trail — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 'redis' is imported (python/ray/serve/_private/broker.py:18), but no entity, schema, table or model declaration this check reads was found beside it, so whether personal data is stored could not be decided.
C4 Data Retention — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 'redis' is imported (python/ray/serve/_private/broker.py:18), but no entity, schema, table or model declaration this check reads was found beside it, so whether personal data is stored could not be decided.
C5 Data-Subject Rights — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 'redis' is imported (python/ray/serve/_private/broker.py:18), but no entity, schema, table or model declaration this check reads was found beside it, so whether personal data is stored could not be decided.
GD1 Unfinished & placeholder code — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby and Scala source only, and this repository's Java, Python, c, cpp is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
IC1 Incompleteness & stubs — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby and Scala source only, and this repository's Python, c, cpp 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.
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.
P7 Outbound HTTP resilience — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 88 further occurrence(s) are not listed individually; the score already reflects all 128.
P8 Schema migrations — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. The schema may be created by a runner, a deploy script or a config file outside what this check reads, so an absence here is our blind spot rather than a missing migration strategy. The card abstains instead of scoring. You can widen what we reach: if the schema is created and evolved by a tool this check does not name, naming it lets us teach the detector to read it.
R10 Code Duplication — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. The filesystem refused the listing or the read of: release/workspace_templates. Every other path was read.
R10 Code Duplication — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 37 further occurrence(s) are not listed individually; the score already reflects all 77.
S1 Web-Security Posture — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These web-security controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks web-security controls.
X3 Exception handling — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 51 further occurrence(s) are not listed individually; the score already reflects all 91.
X4 Structured logging — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 1588 further occurrence(s) are not listed individually; the score already reflects all 1628.
Repo exclusion declarations (.gitattributes linguist-generated/vendored, .editorconfig generated_code): none declared — every source file was scored.
Limitations & what we did not check
Watchdog assesses the repository exactly as committed, and only the repository. By design it does not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.
Per-dimension blind spots
For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.
D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
D9 Test Distribution: The test-pyramid shape is inferred from project/folder naming and references, with a single test host bucketed per-file by its path tier and content signals — a suite that names tiers unconventionally and gives no per-file signal can still be mis-bucketed.
D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
D13 REDACTED Scanning: REDACTED 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").
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 is an LLM read of the decision records present — it cannot know about decisions made and never recorded, and its verdict is sampled and advisory.
D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
D31 IaC & Container Security: IaC scanning checks Dockerfiles/Terraform/Kubernetes against best-practice rules — it cannot see the live cloud account, runtime configuration, or drift between the committed config and what is actually deployed.
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.
D40 Network Egress Confinement: Egress confinement is read from committed Kubernetes manifests — a policy applied out-of-band (cluster-default deny, a service mesh, or a cloud firewall/security group off-repo) is invisible, and a present NetworkPolicy is declared config, not proof the cluster admission-controller actually enforces it at runtime.
D41 Kernel & Syscall Confinement: Syscall/MAC confinement is read from committed manifests — a profile applied by a cluster-wide PodSecurity default or a mutating webhook off-repo isn't seen, and a declared seccomp/AppArmor profile is config presence, not proof the node's kernel actually loaded and enforced it.
D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a REDACTED (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
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.
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.
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.
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.
305 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was tune.run at 86. A further 2 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 AlgorithmConfig._translate_special_keys at 18 — they are counted neither in the figure above nor in this dimension's score. 1 file carries no cyclomatic complexity row at all for this reason — every one of its over-threshold methods was excluded, so the exclusion is disclosed nowhere in the file itself: python/ray/dashboard/modules/log/log_manager.py (LogsManager._categorize_log_files at 16). 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.
+ 299 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 3 bodies over 60 down to 60 or less in Cyclomatic Complexity — start with tune.run (cyclomatic 86), Node.__init__ (cyclomatic 67), worker.init (cyclomatic 62). — 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 6.2 to about 6.5/10, projected with the scoring formula itself and assuming each lands exactly at 60; 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.
+ 711 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 2 bodies over 120 down to 120 or less in Cognitive Complexity — start with CompiledDAG._get_or_compile (cognitive 140), CompiledDAG._visualize_ascii (cognitive 125). — 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 2 together lifts Cognitive Complexity from 5.1 to about 5.3/10, projected with the scoring formula itself and assuming each lands exactly at 120; 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.7 / 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 143 FileTooLong finding(s) in God Classes — start with REDACTED (4), REDACTED (3), REDACTED (2). — One of this dimension's main actionable groups (143 warning-level).
Resolve the 45 TooManyMethods finding(s) in God Classes — start with deployment_state.py (2), REDACTED (2), REDACTED. — One of this dimension's main actionable groups (45 warning-level).
Resolve the 26 FunctionTooLong finding(s) in God Classes — start with REDACTED (2), NodeRow.tsx (2), ActorTable.tsx. — One of this dimension's main actionable groups (26 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.
578 duplicated block group(s) detected. A further 25 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted. 96 of the 603 are in trees this repository does not ship — vendored, example/demo, project-template, fixture and benchmark code — and are ranked below the shipped groups rather than excluded from them: the duplication there is real and is still counted in this dimension's score. The dimensions that publish a production-file census leave those trees out of theirs, so this count is deliberately drawn over the wider population. Measured on part of this repository only: .cc (17% of production source) was not exposed to the token comparison, so duplication there is unmeasured and is not in this count.
+ 213 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 25 Duplicated block (10 lines × 2) finding(s) in Code Duplication — start with ray_experimental_perf.py (2), arrow_serialization.py, actor_manager.py. — One of this dimension's main actionable groups (25 warning-level).
Resolve the 23 Duplicated block (8 lines × 2) finding(s) in Code Duplication — start with disk_shuffle_map_operator.py (2), REDACTED, cloudwatch_helper.py. — One of this dimension's main actionable groups (23 warning-level).
Resolve the 20 Duplicated block (11 lines × 2) finding(s) in Code Duplication — start with keras.py (2), tf_action_dist.py (2), pytorch_optuna.py. — One of this dimension's main actionable groups (20 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.
Do you agree with this assessment?
D5 · Coupling8.6 / 10Strong✓ Tool-verified
What it measures: Whether volatile projects sit underneath others that depend on them (so their churn ripples upward), and whether project dependencies form cycles. A widely-depended-on but stable shared/kernel project is healthy, not penalised.
Method: Dependency cycles via elementary-DFS over real .csproj references, plus Martin instability (afferent/efferent) per project. Exhaustive over the reference graph, deterministic.
Coverage: Exhaustive · type-level: afferent/efferent coupling + cycles computed over every production type — the population is all types, not a name convention.
376 production modules (npm+Python+Bazel), 0 dependency cycle(s), 54 unstable depended-on module(s). Read from the build's own module declarations; 0 module(s) off the main sequence, with abstractness counted on 3 of the 376 (the rest declare no modelled class or interface, export only macros, declare types in source no model reads, or have no source directory of their own).
+ 14 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 11 Unstable project //src/ray/gcs finding(s) in Coupling. — One of this dimension's main actionable groups (11 warning-level).
Resolve the 5 Unstable project //src/ray/core_worker finding(s) in Coupling. — One of this dimension's main actionable groups (5 warning-level).
Resolve the 5 Unstable project //src/ray/object_manager/plasma finding(s) in Coupling. — One of this dimension's main actionable groups (5 warning-level).
Enforce Coupling in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d5_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 23 Low cohesion finding(s) in Cohesion (LCOM4) — start with algorithm_config.py, REDACTED, state_manager.py. — One of this dimension's main actionable groups (23 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.
17124 test methods: 16697 unit, 297 integration, 0 BDD, 130 e2e. The JavaScript/TypeScript suite contributes 123 `it`/`test` case(s) across 38 test file(s) declaring at least one beside 133 .NET test method(s); its tier split is read from package names and paths only. The Python suite contributes 16868 test function(s) across 1489 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 Quality9.5 / 10Stronggated by 5 serious findings✓ 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, 4 zero-assertion, no mocking-framework packages referenced (hand-written doubles or no mocking) across 123 tests. Measured on the JavaScript/TypeScript suite only — at least 1,897 test source file(s) (.py, .java) went unread, so its test quality is unmeasured and is not in these counts.
No assertions: opens a new Ray dashboard · ×4python/ray/dashboard/tests/cypress/e2e/test_render.cy.js:2
Test project verifies nothing: the repository rootpython/ray/dashboard/tests/cypress/e2e/test_render.cy.js:2
What to do
Resolve the 4 No assertions finding(s) in Test Quality — start with ServeStatus.component.test.tsx (3), test_render.cy.js. — One of this dimension's main actionable groups (4 warning-level).
Resolve the 1 Test project verifies nothing finding(s) in Test Quality — start with test_render.cy.js. — One of this dimension's main actionable groups (1 warning-level).
Enforce Test Quality in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d10_recommendation.md · top locations in Appendix A, every location in findings.md.
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 15 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED (2), REDACTED (2), REDACTED. — One of this dimension's main actionable groups (15 issue-level).
Enforce REDACTED 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: Files that change often and are also complex — the riskiest hotspots.
Method: Per production file churn times cyclomatic complexity over a rolling window, computed from git and Roslyn/JS/Razor analysis. Exhaustive, deterministic per commit date.
Resolve the 39 Hotspot finding(s) in Churn × Complexity Hotspots — start with read_api.py, REDACTED, REDACTED. — One of this dimension's main actionable groups (39 warning-level).
Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D16 · Bus Factor9.4 / 10Exemplary✓ Tool-verified
What it measures: Whether knowledge is concentrated in too few people (the "bus factor").
Method: Living knowledge per author via time-decayed commit attribution (6-month half-life, focus weighting) across largest source files. Deterministic, avoids blame's mechanical-refactor false positives.
102 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is python/ray/train/v2/_internal/callbacks/nccl_ras.py. Counted over 1699 of the 2821 production source files in this repository: 1118 are under the ~2,400-byte size floor this dimension measures over, and the remaining 4 have no attributable history left to measure.
Off-boarding risk: anonymized user #1 · ×9
Further sole-owners (lower concentration)
✓ On the Gold path — maintain.
Detailed fixes: d16_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Acknowledged debt left in the code — TODOs, dead code, suppressed warnings.
Method: Roslyn syntactic debt markers (suppressions/TODO/FIXME/HACK/empty-catch/commented-code/Obsolete) plus SymbolFinder dead-code analysis; weighted-debt-per-KLoC density deducted 2.0x per unit. Deterministic, exhaustive.
1720 deducted task-comment markers across 682173 LoC (0.3/KLoC) → score 9.5. Task comments only: this repository's language is read without a compiler, so D17's suppression, dead-code and commented-out-code arms did not run and this score counts fewer marker kinds than a .NET repository's would.
Resolve the 1697 TodoComment finding(s) in Explicit Debt — start with REDACTED (31), algorithm_config.py (31), REDACTED (29). — One of this dimension's main actionable groups (1697 warning-level).
Resolve the 12 HackComment finding(s) in Explicit Debt — start with REDACTED (4), criteo.py, hb_bohb.py. — One of this dimension's main actionable groups (12 warning-level).
Resolve the 7 FixmeComment finding(s) in Explicit Debt — start with read_and_consume_benchmark.py, main.py, __init__.py. — One of this dimension's main actionable groups (7 warning-level).
Enforce Explicit Debt in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.
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. 612 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: Per-ADR judgment by language model at low temperature with two-pass stability; confidence is share of ADRs evaluated; enforcement-field presence detected deterministically. Advisory.
5 of 10 build units (Maven, Python, npm) flagged as possibly oversized/incoherent. This repository's .cc source was read by no build unit, so this covers part of the tree, not all of it.
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: Whether any secrets were ever committed — scanned across the full git history, not just now.
Method: REDACTED scan via TWO gitleaks detect passes in an isolated checkout — the full git history, then a second --no-git pass over the working tree as it stands — merged and de-duplicated by (rule, file, line); each match flagged High. Both invocations are recorded in the audit trail. Exhaustive; when the tool is absent, or when its output cannot be parsed into the expected shape, the dimension is WITHHELD as an explicit measurement gap on our side — unscored and excluded from the lens, never a hedged middling score.
12 finding(s): 0 critical, 12 high, 0 medium, 0 low. Remediation for historically-committed secrets is credential rotation — they remain in history regardless of later deletion.
REDACTED
REDACTED
REDACTED
What to do
Resolve the 11 REDACTED finding(s) in Secrets (history) — start with REDACTED (3), REDACTED, REDACTED. — One of this dimension's main actionable groups (11 issue-level).
Resolve the 1 High secret finding(s) in Secrets (history) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 1 Rotate the exposed credentials finding(s) in Secrets (history). — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d28_recommendation.md · top locations in Appendix A, every location in findings.md.
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).
267 finding(s): 0 critical, 18 high, 194 medium, 55 low. 6 unpinned-GitHub-Actions row(s) are reported here but scored by D36 (supply-chain provenance), which measures that posture as `pinned_actions` — one pinning decision is charged once, not once per lens. semgrep hit a parse error in 318 file(s) — `REDACTED`, `REDACTED`, `ci/ci.sh` (line 381), `REDACTED`, `REDACTED`, … (+313 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.
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
+ 17 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 7 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (3), REDACTED (2), REDACTED. — One of this dimension's main actionable groups (7 issue-level).
Resolve the 3 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (2), REDACTED. — One of this dimension's main actionable groups (3 issue-level).
No action in Static Analysis (SAST) — all 6 REDACTED finding(s) are reported here at file:line but scored by D36 (supply-chain provenance), so none is charged to this dimension. — One of this dimension's main actionable groups (6 issue-level, 0 of them charged here).
Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any dependency has a known published vulnerability (CVE), direct or transitive, in ANY ecosystem the repository declares — Dart pub, Elixir and Erlang via Hex, Go modules, Java and Kotlin via Maven/Gradle, JavaScript/npm, .NET/NuGet, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift.
Method: Dependency-CVE scan across every ecosystem the repository declares, scored ONCE. Three sources are unioned and deduplicated by advisory identity (rule id + alias closure, CVE<->GHSA) scoped to package+version, keeping the worst severity: `osv-scanner --recursive` over osv.dev for Dart pub, Elixir/Hex (and Erlang, whose `rebar.lock` syft first converts to a CycloneDX SBOM the scanner reads, with rows attributed back to the lock), Go, Java and Kotlin via Maven/Gradle (and Scala, whose sbt build's pinned direct declarations are written into a CycloneDX SBOM the scanner reads, with rows attributed back to the build file), npm, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift; `trivy fs --scanners vuln` for npm lockfiles; and `dotnet list package --vulnerable --include-transitive` for NuGet (with per-advisory collapse of the project x target-framework fan-out), plus a DECLARED-dependency arm that resolves a published gem's gemspec against rubygems.org where no Gemfile.lock is committed. `SeverityScore(c,h,m,l, normalizer 8.0)`. NotApplicable only when NO ecosystem is readable; if any applicable ecosystem could not be scanned the findings are REPORTED and the score is withheld. Supersedes the npm and OSV arms, retired 2026-09-05.
+ 2 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 102 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (41), REDACTED (27), REDACTED (15). — One of this dimension's main actionable groups (102 issue-level).
Resolve the 26 Critical CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (9), REDACTED (6), REDACTED (5). — One of this dimension's main actionable groups (26 issue-level).
Resolve the 7 High vulnerability finding(s) in Dependency Vulnerabilities — start with REDACTED (2), REDACTED, REDACTED. — One of this dimension's main actionable groups (7 issue-level).
Detailed fixes: d30_recommendation.md · top locations in Appendix A, every location in findings.md.
Resolve the 81 Medium IaC finding(s) in IaC & Container Security — start with REDACTED (12), REDACTED (6), REDACTED (4). — One of this dimension's main actionable groups (81 warning-level).
Resolve the 45 High IaC finding(s) in IaC & Container Security — start with REDACTED (12), REDACTED (4), REDACTED (3). — One of this dimension's main actionable groups (45 issue-level).
Resolve the 7 Critical IaC finding(s) in IaC & Container Security — start with REDACTED (5), REDACTED, REDACTED. — One of this dimension's main actionable groups (7 issue-level).
Detailed fixes: d31_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.
469 of 1703 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is REDACTED. Counted over 1703 of the 2821 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
Resolve the 437 Orphaned file finding(s) in Knowledge Freshness — start with REDACTED (8), REDACTED (6), REDACTED (4). — One of this dimension's main actionable groups (437 recommendation-level).
Resolve the 32 Orphaned knowledge finding(s) in Knowledge Freshness — start with REDACTED, progress_reporter.py, REDACTED. — One of this dimension's main actionable groups (32 issue-level).
Resolve the 1 Further orphaned files (smaller) finding(s) in Knowledge Freshness. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d34_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.
Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.
Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling. A non-source file is never a coupling PARTICIPANT either: documentation, schemas, config and data files are dropped with the rest, so a code↔docs pair — a command and the reference page that restates it — is not reported however strongly the two co-change; nor is coupling that runs THROUGH a build step or config file.
Resolve the 1 Boundary-crossing change coupling finding(s) in Change Coupling — start with vllm_engine.py. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 8 Change coupling finding(s) in Change Coupling — start with sglang_engine_proc.py, collective_tensor_transport.py, arrow_block.py. — One of this dimension's main actionable groups (8 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.
+ 1 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 2 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED, REDACTED. — One of this dimension's main actionable groups (2 issue-level).
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d36_recommendation.md · top locations in Appendix A, every location in findings.md.
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 Kubernetes workloads restrict network EGRESS with a NetworkPolicy (or Cilium policy), limiting where a compromised pod can send data or reach a command-and-control server. Presence of committed egress-restricting policy, not runtime enforcement.
Method: Deterministic YAML-manifest inspection (no external tool, no Roslyn — language-agnostic): Kubernetes workloads gate applicability; credits a NetworkPolicy / Cilium policy that restricts egress (policyTypes: [Egress] / egress rules). Reward-leaning (neutral floor climbing to 10, never a deduction — baseline misconfigs stay with D31). Deterministic.
What it measures: Whether Kubernetes workloads confine the kernel boundary — a seccomp profile (RuntimeDefault/Localhost) plus an AppArmor/SELinux mandatory-access-control layer — shrinking the syscall attack surface a container escape would use. Presence of committed confinement config, not runtime enforcement.
Method: Deterministic YAML-manifest inspection (no external tool, no Roslyn): on Kubernetes workloads, credits a seccomp profile (RuntimeDefault/Localhost) and an AppArmor/SELinux MAC layer. Reward-leaning (neutral floor climbing to 10); NotApplicable without workloads. Deterministic.
What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. Scored apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.
Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. SCORED, not informational.
What it measures: Whether anyone still ships security patches for the platform this repository RUNS ON — the runtime it pins and the framework majors its own constraints hold it to. Separate from D12 because the question differs: a current Django on an end-of-life Python is perfectly up to date and completely unsupported, and the fix is a migration rather than a version bump. What the repository says it merely SUPPORTS is never charged.
Method: End-of-life PLATFORM read from the repository's own declarations and graded against a FROZEN, dated table of vendor support dates — no network, no feed, no API, so this dimension answers identically inside a closed scan fence. Two subjects: a RUNTIME the project pins (a single or all-end-of-life TargetFramework, a .nvmrc or .python-version, a requires-python CAP) and a FRAMEWORK major a dependency constraint cannot move off (a caret, tilde or exact version; `vue@^2.7.16` pins Vue 2). A FLOOR is deliberately never charged — `requires-python = ">=3.8"` states what a package SUPPORTS, not what it runs on — and a multi-target project is charged only when EVERY target is out of support. Runtime 4.0/product capped 8.0, framework 1.5 capped 4.5. The table is safe to freeze because a statement about support that ended in the past cannot become false: it loses recall as it ages, never precision, and a test asserts every entry predates the freeze date. Disjoint from D31 (a container image's OS layer) and D29 (the toolchain a CI workflow installs). Abstains when the repository declares no platform this pass reads — never scores it clean.
0 end-of-life runtime(s) and 0 end-of-life framework(s), read from 2 platform declaration(s) and 631 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 & labels1.5 / 10Critical✓ 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.
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). — doc/source/_static/js/assistant.js:19
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. — doc/source/_static/js/assistant.js:29
This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed. (×28) — python/ray/dashboard/client/src/components/ActorTable.tsx:366, python/ray/dashboard/client/src/components/ActorTable.tsx:381, python/ray/dashboard/client/src/components/ActorTable.tsx:397, …
This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing it renders carries one either (a name prop is the form-submission key, not a label). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed. (×8) — python/ray/dashboard/client/src/pages/cmd/CMDResult.tsx:72, python/ray/dashboard/client/src/pages/serve/ServeDeploymentMetricsSection.tsx:135, python/ray/dashboard/client/src/pages/serve/ServeDeploymentMetricsSection.tsx:159, …
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.
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.
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). — python/ray/widgets/templates/context_table.html.j2:1
What to do
Declare <html lang>, a document <title> and a <main> landmark, keep headings in order, leave zoom enabled, title iframes and drop meta-refresh.
Other · Accessibility — Whether focus outlines aren't removed without a replacement, motion respects prefers-reduced-motion, and literal CSS colour pairs meet contrast — PARTIAL: inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS literals are read (hex/rgb/hsl/named), never computed/runtime/external-CDN colour. Static markup readiness, not a WCAG conformance claim.
Method: Static markup/CSS scan: inline outline:none/0, literal inline colour/background contrast against the 4.5:1 AA floor, and <style>-block animation without a prefers-reduced-motion guard. Deterministic but PARTIAL — only inline styles and in-repo CSS literals are visible.
Coverage: Population: styled elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx), plus in-repo <style> blocks, in-repo .css files and CSS-in-JS literals. Colour contrast is computed from LITERAL colour pairs only (hex/rgb/hsl/named, including var() tokens and Tailwind neutral utilities) — computed, runtime-themed and external-CDN colour is never resolved, so this is a partial read of contrast by construction. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
`.hljs-dark span.find-kws` sets color: #ffffff on background-color: #b89700 — 2.8:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — python/ray/dashboard/client/src/components/LogView/index.css:7
`#examples-search-input:focus-visible` 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. — doc/source/_static/css/examples.css:34
`.search-button__wrapper.show ~ .chat-widget` moves (`animation: .4s jump ease infinite alternate`) 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. — doc/source/_static/css/assistant.css:37
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 a11y linter (eslint-plugin-jsx-a11y) and no axe/pa11y/Lighthouse in tests or CI. Start with the linter to catch issues at author time. What was searched, so you can tell an absence from a miss: the 119 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: add eslint-plugin-jsx-a11y, then assert with jest-axe in tests, then gate axe/pa11y/Lighthouse in CI.
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 interfaces stay focused rather than fat — the Interface-Segregation principle (SOLID 'I').
Method: Roslyn scan: public interface declared-member counts (accessors fold into their property/event); fat-interface threshold (over 15 declared members) flagged per type. Each finding also reports the distinct-OPERATION count — members counted by name, so an overload group counts once — which decides whether it states the caller-side ISP harm or the implementer-side burden of an overload set. TypeScript: exported interfaces that declare behaviour, counted over their REQUIRED operations (method signatures and function-typed properties with no `?`, once per signature) — data-shape interfaces and ambient .d.ts declarations are outside the population; JavaScript declares no interfaces and is not applicable. Deterministic, type-level.
`RayRuntime` declares 35 abstract methods: `call`, `call`, `call`, `callActor`, `callActor`, `callActor`, `createActor`, `createActor`, `createActor`, `createConcurrencyGroup`, `createPlacementGroup`, `createRuntimeEnv`, `deserializeRuntimeEnv`, `exitActor`, `extractConcurrencyGroups`, `get`, `get`, `get`, `get`, `getActor`, `getActorHandle`, `getAllPlacementGroups`, `getAvailableResourceIds`, `getCurrentNodeId`, `getNamespace`, `getParallelActorContext`, `getPlacementGroup`, `getPlacementGroup`, `getRuntimeContext`, `killActor`, `put`, `removePlacementGroup`, `shutdown`, `wait`, `waitPlacementGroupReady`. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. Those 35 declarations carry 25 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 25 operations clears the >15 bar on its own, so the row is about responsibilities, not signatures. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — java/api/src/main/java/io/ray/api/runtime/RayRuntime.java:35
What to do
Split fat interfaces into focused role-interfaces so clients depend only on what they use.
Do you agree with this assessment?
AX8 · Test isolation10.0 / 10Exemplary✓ Tool-verified
Other · Architecture — Whether production projects stay free of references to test projects — tests may depend on production, never the reverse.
Method: Csproj graph: each production project checked for references to test projects (identified by test-framework presence, not name). Zero violations is clean. Deterministic.
Other · Security — Whether access is authorized by default — a framework authorization attribute/decorator or policy, or imperative guard methods (throw-on-violation) called from handlers.
Method: Roslyn scan: [Authorize] usage and authorization policies, plus imperative throw-on-violation guard methods detected via syntax. Deterministic.
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.
What to do
Add a build/run (quick start) section to the root README — the first thing a newcomer needs.
Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.
Add an 'Architecture' / 'How it works' section to the root README — the high-level shape.
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.
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 & versioning6.0 / 10Adequate✓ Tool-verified
Readiness · Readiness — For a library: a deliberate (small) public API surface and explicit semantic versioning so consumers can depend on it safely.
Method: Roslyn scan: public API surface area and semantic-versioning markers (SemVer attributes, changelog entries) for libraries; off .NET, a library is the ecosystem's publication act (an npm package that is not private and names an entry point, a PyPI distribution with a build system, a Rust library crate, a Maven/Gradle module that publishes, a Go module with no package main, a gemspec, a Composer library, a SwiftPM library product, a pub.dev or Hex package), its surface is the share of types the language model records as public (Rust, Swift, Java, Kotlin, Go, Dart; not measured where the model records no type visibility or, as in TypeScript, only module-level export), and its version is read from the manifest, a semver CHANGELOG, release tooling or semver git tags. Exhaustive, deterministic.
237/259 types (92%) declared in the published library are public. For a library, every public type is a stability contract — keep implementation types off the surface and expose only the intended API.
What to do
Keep implementation types off the public surface (Java: package-private (no modifier), or leave its package out of `module-info` exports) so internals can change without breaking consumers.
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 173844 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.
What to do
Add a SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — so a security regression fails the build instead of landing.
Dependabot is configured but does not watch `github-actions`, `npm`, `maven` — add those `package-ecosystem` entries to REDACTED so those dependencies get the same automatic update and advisory pressure as the ones it already covers.
Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
Readiness · Readiness — Whether releases are automated and safely reversible (probes, rolling updates, approval gates) — from manifests/pipeline files, not the live environment.
Method: Filesystem scan: deployment manifests/IaC (K8s YAML, Helm, Terraform) for rolling updates, probes, approval gates, migration hooks. Exhaustive, deterministic.
Deployment automation exists and the service already exposes health probe endpoints (healthz/livez/readyz or a container healthcheck), but no manifest in this repository wires them into readiness/liveness probes, a rolling-update strategy, lifecycle hooks or a migration job — a bad release is harder to detect and reverse. If that wiring lives in a separate ops/Helm repository, document the pointer here so release safety is evidenced.
What to do
Wire the existing health endpoints into readiness/liveness probes and a rolling-update (or blue/green) strategy in the deployment manifests — or document where that wiring lives — so a bad release is caught and rolled back automatically.
Add an approval/environment gate (required reviewers / protection rules) before production promotion.
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.
`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. (×28) — ci/build/get_build_info.py:24, ci/build/get_build_info.py:32, ci/build/get_build_info.py:75, …
`requests.post(` 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. (×10) — ci/ray_ci/automation/docker_tags_lib.py:286, doc/source/serve/doc_code/autoscale_model_comp_example.py:47, doc/source/serve/doc_code/develop_and_deploy.py:49, …
`requests.delete(` 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. — ci/ray_ci/automation/docker_tags_lib.py:368
`requests.head(` 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. — doc/load_doc_cache.py:47
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 the code is written to minimise allocations so it doesn't pressure its host's memory manager — buffer/slice views over copies, object pooling, stack or value-type allocation, and buffer writers. Reward-only: credited where present, never penalised where a simpler style is fine.
Method: Production-source scan: density (per 1k LoC) of allocation-aware APIs — in .NET Span/Memory, ArrayPool/ObjectPool, stackalloc, ValueTask, value-type structs, IBufferWriter, string.Create, SkipLocalsInit; off .NET, with comments and strings blanked, Go's sync.Pool, preallocated slices/maps, Grow, strconv.Append* and buf[:0] reuse; the JVM's NIO buffer views, MemorySegment, primitive collections, pools and literal presizes (plus Kotlin primitive arrays and value classes, Scala AnyVal and @specialized); Swift's reserveCapacity, ContiguousArray, withUnsafe* access and ~Copyable. Activated off .NET on the same floor (400 lines, and benchmarks or 8 uses); Rust and garbage-collected scripting languages are not applicable. Reward-only. Deterministic, syntax/text detection.
What to do
Raise allocation-aware density on the hot paths — currently 42 use(s) across 17,260 production line(s) (~2.4/1k). More of the idioms below on the allocation-heavy paths climbs this toward 10.
Java: on hot paths, work through buffer views (ByteBuffer/LongBuffer slices, MemorySegment) instead of copies, avoid boxing with primitive collections (fastutil, Eclipse Collections, HPPC, Trove), presize collections and StringBuilders, and pool expensive buffers (Netty's pooled allocator, commons-pool).
Readiness · Performance — Whether asynchronous code stays responsive — it avoids sync-over-async blocking (a .NET .Wait()/.GetAwaiter().GetResult(), a time.sleep or blocking HTTP call inside a Python coroutine, a *Sync call inside an async JavaScript function, block_on inside a Rust async fn, runBlocking inside a Kotlin suspend function, block() inside a Reactor publisher) that stalls a thread or event loop and risks deadlock, and, where the code is a reusable library on .NET, awaits with ConfigureAwait(false) so it never captures and stalls its caller's context.
Method: Production-source scan: sync-over-async blocking counted everywhere — .Wait()/.GetAwaiter().GetResult() in .NET; off .NET, read from the language model, a blocking call inside an async function (Python, TS/JS, Rust, Kotlin, 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.
`run_and_stream_logs` is async and calls subprocess.check_call — a blocking call inside async code stalls the event loop — every other task on it waits for as long as it runs. — REDACTED:248
`ping` is async and calls requests.get — a blocking call inside async code stalls the event loop — every other task on it waits for as long as it runs. — release/benchmarks/distributed/many_nodes_tests/dashboard_test.py:65
`handle_batch` is async and calls time.sleep — a blocking call inside async code stalls the event loop — every other task on it waits for as long as it runs. — release/long_running_tests/workloads/serve.py:59
`__call__` is async and calls requests.get — a blocking call inside async code stalls the event loop — every other task on it waits for as long as it runs. (×3) — release/serve_tests/workloads/resnet_50.py:37, doc/source/serve/doc_code/asyncio_best_practices.py:59, doc/source/serve/doc_code/resnet50_example.py:43
`transcribe` is async and calls subprocess.check_call — a blocking call inside async code stalls the event loop — every other task on it waits for as long as it runs. — doc/source/serve/doc_code/whisper_example.py:53
`asyncio_timeit` is async and calls time.sleep — a blocking call inside async code stalls the event loop — every other task on it waits for as long as it runs. — python/ray/_private/ray_microbenchmark_helpers.py:51
`GetOrCreateRuntimeEnv` is async and calls time.sleep — a blocking call inside async code stalls the event loop — every other task on it waits for as long as it runs. — python/ray/_private/runtime_env/agent/runtime_env_agent.py:472
`main` is async and calls time.sleep — a blocking call inside async code stalls the event loop — every other task on it waits for as long as it runs. — python/ray/llm/examples/serve/example_reset_kv_cache/reset_kv_cache_example.py:146
`run_grpc_benchmark` is async and calls time.sleep — a blocking call inside async code stalls the event loop — every other task on it waits for as long as it runs. — python/ray/serve/_private/benchmarks/streaming/streaming_grpc_throughput.py:106
What to do
Python: await the async equivalent (asyncio.sleep, an async HTTP client such as httpx.AsyncClient or aiohttp, asyncio.create_subprocess_exec), or move the blocking call off the loop with `await asyncio.to_thread(...)`; never call asyncio.run inside a coroutine — await the coroutine.
Do you agree with this assessment?
R1 · Type Safety9.9 / 10Exemplary✓ 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.
What to do
Migrate the remaining .js/.jsx files to TypeScript.
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.
9 duplicated blocks under python/ray/dashboard/client/src/pages/ have copies in at least two of the sibling directories actor, job, node, serve — 6 of them are reported below, and 3 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 9 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 9 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 9 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — python/ray/dashboard/client/src/pages/actor/ActorDetail.tsx:63
6 of the duplicated blocks reported below have copies in at least two of the sibling directories components, pages, util under python/ray/dashboard/client/src/. That concentration is one structural fact, not 6 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 6 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — python/ray/dashboard/client/src/components/TaskTable.tsx:197
python/ray/dashboard/client/src/pages/serve/ServeApplicationDetailPage.tsx:63 · python/ray/dashboard/client/src/pages/serve/ServeDeploymentDetailPage.tsx:67 — the two spans are one implementation copied and then locally edited — 838 tokens are still identical, in the same order in both files, 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. — python/ray/dashboard/client/src/pages/serve/ServeApplicationDetailPage.tsx:63
python/ray/dashboard/client/src/components/PlacementGroupTable.tsx:76 · python/ray/dashboard/client/src/components/TaskTable.tsx:57 — the two spans are one implementation copied and then locally edited — 820 tokens are still identical, in the same order in both files, 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. — python/ray/dashboard/client/src/components/PlacementGroupTable.tsx:76
python/ray/dashboard/client/src/pages/actor/ActorDetail.tsx:63 · python/ray/dashboard/client/src/pages/job/JobDetailInfoPage.tsx:44 — the two spans are one implementation copied and then locally edited — 221 tokens are still identical, in the same order in both files, 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. — python/ray/dashboard/client/src/pages/actor/ActorDetail.tsx:63
python/ray/dashboard/client/src/pages/node/AcceleratorColumn.tsx:102 · python/ray/dashboard/client/src/pages/node/AcceleratorMemoryColumn.tsx:34 — the two spans are one implementation copied and then locally edited — 250 tokens are still identical, in the same order in both files, 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. — python/ray/dashboard/client/src/pages/node/AcceleratorColumn.tsx:102
python/ray/dashboard/client/src/pages/serve/ServeDeploymentMetricsSection.tsx:106 · python/ray/dashboard/client/src/pages/serve/ServeMetricsSection.tsx:121 — the 2 copies are spread across 2 files, 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. — python/ray/dashboard/client/src/pages/serve/ServeDeploymentMetricsSection.tsx:106
python/ray/dashboard/client/src/pages/job/TaskProgressBar.tsx:34 · python/ray/dashboard/client/src/pages/job/TaskProgressBar.tsx:145 — all 2 copies are in the same file, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — python/ray/dashboard/client/src/pages/job/TaskProgressBar.tsx:34
python/ray/dashboard/client/src/pages/serve/ServeDeploymentMetricsSection.tsx:56 · python/ray/dashboard/client/src/pages/serve/ServeMetricsSection.tsx:82 — the 2 copies are spread across 2 files, 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. — python/ray/dashboard/client/src/pages/serve/ServeDeploymentMetricsSection.tsx:56
python/ray/dashboard/client/src/pages/serve/hook/useServeApplications.ts:85 · python/ray/dashboard/client/src/pages/serve/hook/useServeApplications.ts:148 — 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. — python/ray/dashboard/client/src/pages/serve/hook/useServeApplications.ts:85
python/ray/dashboard/client/src/components/ActorTable.tsx:801 · python/ray/dashboard/client/src/components/TaskTable.tsx:288 — the 2 copies are spread across 2 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — python/ray/dashboard/client/src/components/ActorTable.tsx:801
python/ray/dashboard/client/src/pages/node/AcceleratorMemoryColumn.tsx:15 · python/ray/dashboard/client/src/pages/node/AcceleratorMemoryColumn.tsx:59 — the two spans are one implementation copied and then locally edited — 182 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. — python/ray/dashboard/client/src/pages/node/AcceleratorMemoryColumn.tsx:15
python/ray/dashboard/client/src/common/links.tsx:6 · python/ray/dashboard/client/src/common/links.tsx:39 — 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. — python/ray/dashboard/client/src/common/links.tsx:6
python/ray/dashboard/client/src/pages/node/NodeRow.tsx:77 · python/ray/dashboard/client/src/pages/serve/ServeApplicationRow.tsx:45 — the 2 copies are spread across 2 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — python/ray/dashboard/client/src/pages/node/NodeRow.tsx:77
python/ray/dashboard/client/src/App.tsx:453 · python/ray/dashboard/client/src/App.tsx:479 · python/ray/dashboard/client/src/App.tsx:528 — 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. — python/ray/dashboard/client/src/App.tsx:453
python/ray/dashboard/client/src/common/ProfilingLink.tsx:544 · python/ray/dashboard/client/src/common/ProfilingLink.tsx:641 — 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. — python/ray/dashboard/client/src/common/ProfilingLink.tsx:544
python/ray/dashboard/client/src/pages/serve/ServeEntityLogViewer.tsx:255 · python/ray/dashboard/client/src/pages/serve/ServeEntityLogViewer.tsx:285 — all 2 copies are in the same file, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — python/ray/dashboard/client/src/pages/serve/ServeEntityLogViewer.tsx:255
python/ray/dashboard/client/src/common/ProfilingLink.tsx:522 · python/ray/dashboard/client/src/common/ProfilingLink.tsx:557 — 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. — python/ray/dashboard/client/src/common/ProfilingLink.tsx:522
python/ray/dashboard/client/src/pages/job/JobTaskNameProgressTable/JobTaskNameProgressTable.tsx:41 · python/ray/dashboard/client/src/pages/job/index.tsx:148 — the 2 copies are spread across 2 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — python/ray/dashboard/client/src/pages/job/JobTaskNameProgressTable/JobTaskNameProgressTable.tsx:41
python/ray/dashboard/client/src/pages/serve/ServeDeploymentMetricsSection.tsx:176 · python/ray/dashboard/client/src/pages/serve/ServeMetricsSection.tsx:193 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — python/ray/dashboard/client/src/pages/serve/ServeDeploymentMetricsSection.tsx:176
python/ray/dashboard/client/src/components/ActorTable.tsx:571 · python/ray/dashboard/client/src/components/PlacementGroupTable.tsx:157 · python/ray/dashboard/client/src/components/TaskTable.tsx:183 — the 3 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. There is one copy in each of 3 separate files rather than several in one place, so check first whether these are sibling modules that each declare their own version of one shape — one per entity, per provider, per language. Where they are, no single extracted module collapses them: each module still has to be written, and what recurs is the TEMPLATE. The moves that do collapse a template are to generate these modules from the set they enumerate, or to replace the repeated construction with one factory each site calls with its own values — and where the set is the point, each module pinning one distinct thing, the repetition IS the enumeration and there is nothing to delete. — python/ray/dashboard/client/src/components/ActorTable.tsx:571
python/ray/dashboard/client/src/components/PlacementGroupTable.tsx:26 · python/ray/dashboard/client/src/components/PlacementGroupTable.tsx:45 — 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. — python/ray/dashboard/client/src/components/PlacementGroupTable.tsx:26
python/ray/dashboard/client/src/components/TaskTable.tsx:197 · python/ray/dashboard/client/src/pages/job/JobTaskNameProgressTable/JobTaskNameProgressTable.tsx:43 · python/ray/dashboard/client/src/pages/job/index.tsx:150 · REDACTED:385 — the 4 copies are spread across 4 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — python/ray/dashboard/client/src/components/TaskTable.tsx:197
REDACTED:390 · python/ray/dashboard/client/src/pages/serve/ServeApplicationDetailPage.tsx:206 · python/ray/dashboard/client/src/pages/serve/ServeDeploymentDetailPage.tsx:193 — the 3 copies are spread across 3 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — REDACTED:390
python/ray/dashboard/client/src/pages/job/JobDetailInfoPage.tsx:182 · python/ray/dashboard/client/src/pages/job/JobRow.tsx:120 — the 2 copies are spread across 2 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — python/ray/dashboard/client/src/pages/job/JobDetailInfoPage.tsx:182
python/ray/dashboard/client/src/pages/serve/ServeDeploymentMetricsSection.tsx:214 · python/ray/dashboard/client/src/pages/serve/ServeMetricsSection.tsx:228 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — python/ray/dashboard/client/src/pages/serve/ServeDeploymentMetricsSection.tsx:214
python/ray/dashboard/client/src/common/ServeStatus.tsx:21 · python/ray/dashboard/client/src/common/ServeStatus.tsx:37 — 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. — python/ray/dashboard/client/src/common/ServeStatus.tsx:21
python/ray/dashboard/client/src/components/EventTable.tsx:142 · python/ray/dashboard/client/src/components/EventTable.tsx:158 · python/ray/dashboard/client/src/components/EventTable.tsx:174 · python/ray/dashboard/client/src/components/EventTable.tsx:190 — all 4 copies are in the same file, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — python/ray/dashboard/client/src/components/EventTable.tsx:142
python/ray/dashboard/client/src/components/LogView/LogVirtualView.tsx:124 · python/ray/dashboard/client/src/components/LogView/LogVirtualView.tsx:159 — all 2 copies are in the same file, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — python/ray/dashboard/client/src/components/LogView/LogVirtualView.tsx:124
python/ray/dashboard/client/src/pages/overview/cards/ClusterUtilizationCard.tsx:15 · python/ray/dashboard/client/src/pages/overview/cards/NodeCountCard.tsx:17 — the 2 copies are spread across 2 files, 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. — python/ray/dashboard/client/src/pages/overview/cards/ClusterUtilizationCard.tsx:15
python/ray/dashboard/client/src/pages/serve/ServeSystemDetailRows.tsx:88 · python/ray/dashboard/client/src/pages/serve/ServeSystemDetailRows.tsx:110 — 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. — python/ray/dashboard/client/src/pages/serve/ServeSystemDetailRows.tsx:88
python/ray/dashboard/client/src/common/JobStatus.tsx:65 · python/ray/dashboard/client/src/common/JobStatus.tsx:80 · python/ray/dashboard/client/src/common/JobStatus.tsx:95 — 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. — python/ray/dashboard/client/src/common/JobStatus.tsx:65
python/ray/dashboard/client/src/components/ActorTable.tsx:370 · python/ray/dashboard/client/src/components/ActorTable.tsx:386 — 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. — python/ray/dashboard/client/src/components/ActorTable.tsx:370
python/ray/dashboard/client/src/components/ActorTable.tsx:431 · python/ray/dashboard/client/src/components/ActorTable.tsx:450 · python/ray/dashboard/client/src/components/ActorTable.tsx:467 · python/ray/dashboard/client/src/components/ActorTable.tsx:484 · +2 more site(s) not listed — the 6 copies are spread across 2 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — python/ray/dashboard/client/src/components/ActorTable.tsx:431
python/ray/dashboard/client/src/components/ActorTable.tsx:595 · python/ray/dashboard/client/src/components/TaskTable.tsx:201 · python/ray/dashboard/client/src/pages/job/JobTaskNameProgressTable/JobTaskNameProgressTable.tsx:47 · python/ray/dashboard/client/src/pages/job/index.tsx:154 · +1 more site(s) not listed — the 5 copies are spread across 5 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — python/ray/dashboard/client/src/components/ActorTable.tsx:595
python/ray/dashboard/client/src/components/DataOverviewTable.tsx:129 · REDACTED:394 · python/ray/dashboard/client/src/pages/serve/ServeApplicationDetailPage.tsx:211 · python/ray/dashboard/client/src/pages/serve/ServeDeploymentDetailPage.tsx:198 · +1 more site(s) not listed — the 5 copies are spread across 5 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — python/ray/dashboard/client/src/components/DataOverviewTable.tsx:129
python/ray/dashboard/client/src/pages/job/JobDetail.tsx:214 · python/ray/dashboard/client/src/pages/job/JobDetail.tsx:231 — all 2 copies are in the same file, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — python/ray/dashboard/client/src/pages/job/JobDetail.tsx:214
python/ray/dashboard/client/src/pages/job/index.tsx:116 · python/ray/dashboard/client/src/pages/serve/ServeDeploymentsListPage.tsx:87 — the 2 copies are spread across 2 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — python/ray/dashboard/client/src/pages/job/index.tsx:116
python/ray/dashboard/client/src/common/ProfilingLink.tsx:477 · python/ray/dashboard/client/src/common/ProfilingLink.tsx:667 — 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. — python/ray/dashboard/client/src/common/ProfilingLink.tsx:477
python/ray/dashboard/client/src/pages/job/hook/useJobProgress.ts:79 · python/ray/dashboard/client/src/pages/job/hook/useJobProgress.ts:315 — 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. — python/ray/dashboard/client/src/pages/job/hook/useJobProgress.ts:79
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 · Architecture — Conformance to the detected frontend architecture layout (feature-sliced / layered src) plus cross-package deep-import rules (D-386).
Method: Conformance to the detected frontend layout (feature-sliced / layered src) plus cross-package deep-import rules, over the module graph. Deterministic.
python/ray/dashboard/client/src/pages/layout/SideTabLayout.tsx:3 imports react-icons/lib, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — python/ray/dashboard/client/src/pages/layout/SideTabLayout.tsx:3
What to do
Fix the listed violations: import through public entries (package exports / slice index), never reach into another layer or package's internals.
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.
ServeEntityLogViewer has cyclomatic complexity 28 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. — python/ray/dashboard/client/src/pages/serve/ServeEntityLogViewer.tsx:32
(anonymous) has cyclomatic complexity 21 and cognitive complexity 20; 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. — python/ray/dashboard/client/src/components/ActorTable.tsx:613
ActorDetailPage has cyclomatic complexity 21 and cognitive complexity 20; 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. — python/ray/dashboard/client/src/pages/actor/ActorDetail.tsx:53
NodeDetailPage has cyclomatic complexity 20 and cognitive complexity 14; 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. — python/ray/dashboard/client/src/pages/node/NodeDetail.tsx:15
AdvancedProgressBarSegment has cyclomatic complexity 18 and cognitive complexity 17; 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. — python/ray/dashboard/client/src/pages/job/AdvancedProgressBar/AdvancedProgressBar.tsx:78
(anonymous) has cyclomatic complexity 16 and cognitive complexity 15; 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. — python/ray/dashboard/client/src/components/TaskTable.tsx:218
TaskPageContents has cyclomatic complexity 16 and cognitive complexity 15; 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. — python/ray/dashboard/client/src/pages/task/TaskPage.tsx:67
DataRow has cyclomatic complexity 16 and cognitive complexity 13; 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. — python/ray/dashboard/client/src/components/DataOverviewTable.tsx:162
JobRow has cyclomatic complexity 15 and cognitive complexity 14; 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. — python/ray/dashboard/client/src/pages/job/JobRow.tsx:21
ServeReplicaDetailPage has cyclomatic complexity 15 and cognitive complexity 13; 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. — python/ray/dashboard/client/src/pages/serve/ServeReplicaDetailPage.tsx:23
ProgressBar has cyclomatic complexity 14 and cognitive complexity 13; 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. — python/ray/dashboard/client/src/components/ProgressBar/ProgressBar.tsx:73
JobStatusIcon has cyclomatic complexity 13 and cognitive complexity 19; 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. — python/ray/dashboard/client/src/common/JobStatus.tsx:58
ServeSystemActorDetail has cyclomatic complexity 13 and cognitive complexity 11; 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. — python/ray/dashboard/client/src/pages/serve/ServeSystemActorDetailPage.tsx:120
NodeRow has cyclomatic complexity 13 and cognitive complexity 10; 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. — python/ray/dashboard/client/src/pages/node/NodeRow.tsx:51
JobMetadataSection has cyclomatic complexity 12 and cognitive complexity 11; 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. — python/ray/dashboard/client/src/pages/job/JobDetailInfoPage.tsx:79
MetadataContentField has cyclomatic complexity 11 and cognitive complexity 12; 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. — python/ray/dashboard/client/src/components/MetadataSection/MetadataSection.tsx:69
JobProgressBar has cyclomatic complexity 11 and cognitive complexity 9; 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. — python/ray/dashboard/client/src/pages/job/JobProgressBar.tsx:16
What to do
Break down the listed branch-heavy functions; aim P95 cyclomatic ≤ 5.
Do you agree with this assessment?
R3 · Large Files8.1 / 10Strong✓ 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.
python/ray/dashboard/client/src/components/ActorTable.tsx has 836 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — python/ray/dashboard/client/src/components/ActorTable.tsx:1
python/ray/dashboard/client/src/common/timezone.ts has 678 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — python/ray/dashboard/client/src/common/timezone.ts:1
python/ray/dashboard/client/src/common/ProfilingLink.tsx has 644 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — python/ray/dashboard/client/src/common/ProfilingLink.tsx:1
python/ray/dashboard/client/src/App.tsx has 569 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — python/ray/dashboard/client/src/App.tsx:1
python/ray/dashboard/client/src/pages/layout/MainNavLayout.tsx has 443 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — python/ray/dashboard/client/src/pages/layout/MainNavLayout.tsx:1
REDACTED has 436 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
python/ray/dashboard/client/src/components/LogView/LogVirtualView.tsx has 411 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — python/ray/dashboard/client/src/components/LogView/LogVirtualView.tsx:1
python/ray/dashboard/client/src/pages/node/NodeRow.tsx has 411 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — python/ray/dashboard/client/src/pages/node/NodeRow.tsx: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 Coverage9.1 / 10Exemplary✓ 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. (×14) — python/ray/dashboard/client/src/pages/actor/hook/mockedUseActorList.ts:1, python/ray/dashboard/client/src/common/SortableTableHead.tsx:1, python/ray/dashboard/client/src/pages/serve/mockServeApplication.ts:1, …
What to do
Add tests that import the unreached modules (directly or through their public entry).
React / JS · Readiness — How outdated the npm dependencies are (a maturity signal). JS/npm CVEs are scored separately in D30 (JS/npm Dependency Vulnerabilities).
Method: npm dependency staleness from manifest/registry metadata (a maturity signal; JS/npm CVEs are scored separately in D30, which answers dependency vulnerabilities for every ecosystem). Deterministic.
What to do
Bump outdated dependencies to current versions to limit upgrade debt.
Do you agree with this assessment?
R6 · Tooling6.7 / 10Adequate✓ Tool-verified
React / JS · Readiness — Whether the project wires up test, lint and typecheck — detected from each package.json script's COMMAND (eslint / tsc / vitest / jest / playwright), not just its name, and corroborated against CI-workflow invocations so a tool run only in CI still counts.
Method: package.json scanned for test/lint/typecheck script wiring. Deterministic presence check.
test ✓ · lint ✓ · typecheck ✗ — read from this repository's package.json scripts and corroborated against its CI workflows. A script counts when its name or command matches the step: `test` for the suite, `lint` or `prettier` for linting, `typecheck`/`type-check`/`tsc` for type checking. ✗ therefore means no script or CI step under those names was found, NOT that the step is absent from your pipeline — a task invoked by a runner this check does not read, or named something else entirely, is not seen and is worth confirming before acting on a cross. A ✓ means the wiring is DECLARED — a script or CI step under those names exists. It is not a statement that the step passes, or that it runs at all: nothing here installs a dependency or executes a suite.
What to do
Add `tsc --noEmit` as package.json scripts and run them in CI.
Do you agree with this assessment?
R7 · Dead Code8.1 / 10Strong✓ 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.
3 file(s) (~26 LoC) were excluded from dead-code analysis — declare main/module/exports or a conventional entry (src/index.*, an index.html script) so reachability can see this package.
Unreachable from the 3 application, 10 tooling and 41 test entry point(s) detected in this repo. Gate removals on `npm run build` — an undetected custom entry would make these reachable.
no import path from any entry point (3 application, 10 tooling, 41 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make (×14) — python/ray/dashboard/client/src/pages/actor/hook/mockedUseActorList.ts, python/ray/dashboard/client/src/common/SortableTableHead.tsx, python/ray/dashboard/client/src/pages/serve/mockServeApplication.ts, …
no import path from any entry point (3 application, 10 tooling, 41 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (python/ray/dashboard/client/src/common/SortableTableHead.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it (×2) — python/ray/dashboard/client/src/common/tableUtils.ts, python/ray/dashboard/client/src/common/TableCell.tsx
Nothing imports this binding — it is safe to review for removal. (×16) — python/ray/dashboard/client/src/common/formatUtils.ts:16, python/ray/dashboard/client/src/common/formatUtils.ts:33, python/ray/dashboard/client/src/common/formatUtils.ts:36, …
What to do
Delete the dead files and unused exports — every line is maintenance cost and rebuild-estimate inflation with zero runtime value.
React / JS · Readiness — npm dependency truthfulness (D-386): unused dependencies, imports not declared anywhere, and type-/test-only packages shipped as production deps.
Method: npm dependency truthfulness: unused dependencies, imports declared nowhere, and type-/test-only packages shipped as production deps — from the manifest + import graph. Deterministic.
Imported but not declared in any reachable package.json — installs work only by hoisting accident. — python/ray/dashboard/client/src/components/LogView/LogVirtualView.tsx:3
Declared in python/ray/dashboard/client/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it. (×3)
What to do
Remove unused dependencies, declare unlisted imports explicitly, and demote type-/test-only packages to devDependencies.
Do you agree with this assessment?
R9 · Circular Imports4.7 / 10Weak✓ Tool-verified
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.
python/ray/dashboard/client/src/App.tsx → python/ray/dashboard/client/src/pages/actor/ActorDetail.tsx → python/ray/dashboard/client/src/pages/actor/ActorLogs.tsx → python/ray/dashboard/client/src/common/MultiTabLogViewer.tsx → python/ray/dashboard/client/src/pages/log/LogViewer.tsx → python/ray/dashboard/client/src/App.tsx (one verified cycle inside a mutually-dependent group of 38 files) — python/ray/dashboard/client/src/App.tsx:14
What to do
Break each cycle by extracting the shared piece into a module both sides can import.
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. (×6) — REDACTED:475, REDACTED:494, REDACTED:534, …
This `async def` runs on the event loop's thread, and `time.sleep` blocks that thread: for the whole delay no other coroutine, request or callback on the loop makes progress — the Python form of blocking on a task. Use `await asyncio.sleep(…)`, which suspends only this coroutine. Where the blocking work is not a sleep but a synchronous call that cannot be made async, move it off the loop with `await asyncio.to_thread(…)` (or `loop.run_in_executor(…)`). (×2) — python/ray/_private/ray_microbenchmark_helpers.py:60, python/ray/_private/runtime_env/agent/runtime_env_agent.py:676
What to do
Task from `self._event_loop.create_task` is not kept
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 reader1.8 / 10Critical✓ 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.
`address_len` is read from the bytes being parsed at line 363 (`int.from_bytes(… 8 bytes …)`), then passed as the size of `read` at line 368 — and nowhere in its function is `address_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 `address_len` against the bytes actually remaining and a maximum the format allows before reading. — python/ray/_private/external_storage.py:368
`metadata_len` is read from the bytes being parsed at line 364 (`int.from_bytes(… 8 bytes …)`), then passed as the size of `read` at line 369 — and nowhere in its function is `metadata_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 `metadata_len` against the bytes actually remaining and a maximum the format allows before reading. — python/ray/_private/external_storage.py:369
`address_len` is read from the bytes being parsed at line 534 (`int.from_bytes(… 8 bytes …)`), then passed as the size of `read` at line 538 — and nowhere in its function is `address_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 `address_len` against the bytes actually remaining and a maximum the format allows before reading. — python/ray/_private/external_storage.py:538
`metadata_len` is read from the bytes being parsed at line 535 (`int.from_bytes(… 8 bytes …)`), then passed as the size of `read` at line 540 — and nowhere in its function is `metadata_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 `metadata_len` against the bytes actually remaining and a maximum the format allows before reading. — python/ray/_private/external_storage.py:540
`len` is read from the bytes being parsed at line 113 (`readInt`), then used to size a `new byte[]` at line 114 — and nowhere in its scope is `len` bounded from above — compared to a limit, clamped, or checked against the input that remains (a zero or sign test, or the loop that counts up to it, bounds nothing). Whoever wrote those bytes therefore chooses the allocation directly: a 32-bit length asks for up to 2 GiB before a single byte of the payload is known to exist, which either exhausts the heap with an `OutOfMemoryError` or, negative, throws `NegativeArraySizeException` out of a parser whose failure path was written for malformed input, not for hostile input. Bound `len` against the bytes actually remaining and a maximum the format allows before allocating. — java/runtime/src/main/java/io/ray/runtime/object/ObjectRefImpl.java:114
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 document1.6 / 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.
`remote` is public, takes a document from its caller (line 1717) and hands it to `_remote`, which calls itself at line 1923 (`self._remote`) with a piece of `actor_options` — and nowhere in `_remote` 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 `_remote` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — python/ray/actor.py:1923
`generate_variants` is public, takes a document from its caller (line 17) and hands it to `_generate_variants_internal`, which calls itself at line 278 (`_generate_variants_internal`) with a piece of `spec` — and nowhere in `_generate_variants_internal` 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 `_generate_variants_internal` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — REDACTED:278
`parse_spec_vars` is public, takes a document from its caller (line 185) and hands it to `_split_resolved_unresolved_values`, which calls itself at line 492 (`_split_resolved_unresolved_values`) with a piece of `spec` — and nowhere in `_split_resolved_unresolved_values` 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 `_split_resolved_unresolved_values` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — REDACTED:492
`convert_search_space` is public and takes `spec: Dict` from its caller, and it calls itself at line 527 (`self.convert_search_space`) with a piece of `spec` — and nowhere in `convert_search_space` 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 `convert_search_space` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — python/ray/tune/search/hyperopt/hyperopt_search.py:527
`convert_numpy_to_python_primitives` is public and takes `obj: Any` from its caller, and it calls itself at line 37 (`convert_numpy_to_python_primitives`) with a piece of `obj` (and at line 40, line 42, line 54) — and nowhere in `convert_numpy_to_python_primitives` 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 `convert_numpy_to_python_primitives` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — python/ray/rllib/utils/serialization.py:37
`gym_space_from_dict` is public and takes `d: Dict` from its caller, and it calls itself at line 268 (`gym_space_from_dict`) with a piece of `d` (and at line 282, line 290, line 294) — and nowhere in `gym_space_from_dict` 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 `gym_space_from_dict` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — python/ray/rllib/utils/serialization.py:268
`space_from_dict` is public and takes `d: Dict` from its caller, and it calls itself at line 331 (`space_from_dict`) with a piece of `d` — and nowhere in `space_from_dict` 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 `space_from_dict` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — python/ray/rllib/utils/serialization.py:331
`from_state` is public and takes `state: Dict[str, Any]` from its caller, and it calls itself at line 722 (`self.from_state`) with a piece of `state` — and nowhere in `from_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_state` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — python/ray/rllib/utils/metrics/legacy_stats.py:722
`is_text_only_chat` is public, takes a document from its caller (line 50) and hands it to `_is_text_content`, which calls itself at line 28 (`_is_text_content`) with a piece of `content` — and nowhere in `_is_text_content` 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 `_is_text_content` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — REDACTED:28
`deep_merge_dicts` is public and takes `base: Dict[str, Any]` from its caller, and it calls itself at line 55 (`deep_merge_dicts`) with a piece of `base` — and nowhere in `deep_merge_dicts` 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 `deep_merge_dicts` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — python/ray/llm/_internal/common/dict_utils.py:55
`redact_runtime_env_deep` is public and takes `payload: Any` from its caller, and it calls itself at line 73 (`redact_runtime_env_deep`) with a piece of `payload` (and at line 76) — and nowhere in `redact_runtime_env_deep` 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 `redact_runtime_env_deep` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — python/ray/dashboard/runtime_env_redaction.py:73
`setup_wandb` is public, takes a document from its caller (line 62) and hands it to `_clean_log`, which calls itself at line 232 (`_clean_log`) with a piece of `obj` (and at line 237, line 242) — and nowhere in `_clean_log` 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 `_clean_log` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — REDACTED:232
`contains_tensor` is public and takes `obj: Any` from its caller, and it calls itself at line 63 (`contains_tensor`) with a piece of `obj` (and at line 65, line 69) — and nowhere in `contains_tensor` 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 `contains_tensor` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — python/ray/air/_internal/torch_utils.py:63
`deep_update` is public and takes `original: dict` from its caller, and it calls itself at line 81 (`deep_update`) with a piece of `original` (and at line 89) — and nowhere in `deep_update` 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 `deep_update` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — python/ray/_private/dict.py:81
`from_dict` is public, takes a document from its caller (line 68) and hands it to `_substitute_build_args`, which calls itself at line 36 (`_substitute_build_args`) with a piece of `obj` (and at line 40) — and nowhere in `_substitute_build_args` 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 `_substitute_build_args` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — ci/raydepsets/workspace.py:36
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 0/2 async functions that make a cancellable request (fetch, axios, ky, ofetch) 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.
`authenticateWithToken` awaits `axios.post(…)` 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: `axios.post(url, { signal })`. — python/ray/dashboard/client/src/authentication/authentication.ts:38
`readStream` 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 })`. — doc/source/_static/js/assistant.js:143
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 an argument guard throws the exception its own condition describes — a guard that rejects a value for being EMPTY and reports it as `NullPointerException` (Java, Kotlin, Scala), `ArgumentError.notNull` (Dart) or `ArgumentNullException` (F#'s `nullArg`) tells the caller a parameter was null when it provably was not.
Method: Roslyn syntax: `throw new ArgumentNullException(nameof(p))` statements controlled by an `if`, whose condition is read for a test that is true of a NON-null `p` — an emptiness test that dereferences it (`p.Count == 0`, `!p.Any()`) or a BCL predicate documented true of the empty value (`string.IsNullOrEmpty(p)`). Deterministic, provable per finding. Advisory.
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.
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 50 is called with an argument built by `json.dumps(result_json)` (line 50), 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. — release/ray_release/reporter/db.py:50
`debug` at line 180 is called with an argument built by `json.dumps(response)` (line 180), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on. — REDACTED:180
`debug` at line 4012 is called with an argument built by `deployment_info.to_dict()` (line 4012), 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. — python/ray/serve/_private/deployment_state.py:4012
`debug` at line 4013 is called with an argument built by `info.to_dict()` (line 4015), 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. — python/ray/serve/_private/deployment_state.py:4013
`debug` at line 279 is called with an argument built by `list(updates.keys())` (line 280), 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. — python/ray/serve/_private/long_poll.py:279
`debug` at line 1175 is called with an argument built by `[self._get_partition_stats(pid) for pid in target_partition_ids]` (line 1177), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on. — REDACTED:1175
`debug` at line 149 is called with an argument built by `sorted(held_blocks, key = lambda slot : (slot.parent_lineage_task_id, slot.output_index,),)` (line 156), 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. — python/ray/data/_internal/execution/operators/lineage_reconstruction_mixin.py:149
`debug` at line 394 is called with an argument built by `[item.file.path if item.run is None else (item.file.path, item.run.unit_ids) for item in bin_.items]` (line 401), 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. — python/ray/data/_internal/datasource_v2/common/online_bin_packer.py:394
`debug` at line 616 is called with an argument built by `"…".join(formatted_bundles)` (line 616), 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. — python/ray/data/_internal/cluster_autoscaler/rate_based_cluster_autoscaler.py:616
`debug` at line 110 is called with an argument built by `dict(cluster_resources)` (line 110), 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. — python/ray/autoscaler/v2/event_logger.py:110
`verbose` at line 450 is called with an argument built by `"…".join(command)` (line 450), 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 verbose 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. — python/ray/autoscaler/_private/command_runner.py:450
`verbose` at line 475 is called with an argument built by `"…".join(command)` (line 475), 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 verbose 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. — python/ray/autoscaler/_private/command_runner.py:475
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 an enhanced `for` leaves the collection it is walking alone — a body that adds to or removes from the very collection the loop is iterating invalidates the fail-fast iterator it is holding, so the next `next()` throws `ConcurrentModificationException` and the remaining elements are never seen. Whether a `for` loop leaves the `dict`, `set` or `deque` it is walking alone — CPython's iterators over those check that the collection has not changed size since the loop began, so a body that removes from (or empties) the very collection the loop is walking makes the next step raise `RuntimeError: dictionary changed size during iteration` and the remaining items are never seen.
Method: Roslyn syntax + semantics: `foreach` statements whose body calls a structural mutator (`Add`/`Remove`/`Clear`/`Insert`/…) on the very expression the loop is enumerating. Two arms. ARM A — the source is a concrete fragile BCL collection, or a live `Keys`/`Values` view over one, and the mutator resolves to that same collection's own member; concurrent and immutable collections and arrays are outside the population by construction, since their enumerators survive a structural change. ARM B — the source is an argument-less accessor CALL on a receiver whose body is in source: the accessor must return a stored field VERBATIM and a sibling member must structurally change that same field, both read off the implementations rather than from the members' names. A mutation the loop provably exits immediately after (`break`/`return`/`throw`/`goto`), or one written inside a nested loop or a lambda, is counted and never reported. Deterministic, provable per finding. Advisory.
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. (×17) — release/ray_release/aws.py:55, python/ray/util/check_serialize.py:232, python/ray/util/tpu.py:1250, …
`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. (×23) — release/ray_release/command_runner/anyscale_job_runner.py:185, release/ray_release/buildkite/filter.py:17, REDACTED:1164, …
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.
`warning` at line 67 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. — release/ray_release/command_runner/_anyscale_job_wrapper.py:67
`warning` at line 80 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. — release/ray_release/command_runner/_anyscale_job_wrapper.py:80
`info` at line 141 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. — release/ray_release/command_runner/_anyscale_job_wrapper.py:141
`error` at line 159 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. — release/ray_release/command_runner/_anyscale_job_wrapper.py:159
`error` at line 166 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. — release/ray_release/command_runner/_anyscale_job_wrapper.py:166
`info` at line 201 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. — release/ray_release/command_runner/_anyscale_job_wrapper.py:201
`info` at line 215 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. — release/ray_release/command_runner/_anyscale_job_wrapper.py:215
`warning` at line 225 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. — release/ray_release/command_runner/_anyscale_job_wrapper.py:225
`info` at line 230 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. — release/ray_release/command_runner/_anyscale_job_wrapper.py:230
`error` at line 258 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. — release/ray_release/command_runner/_anyscale_job_wrapper.py:258
`info` at line 262 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. — release/ray_release/command_runner/_anyscale_job_wrapper.py:262
`error` at line 284 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. — release/ray_release/command_runner/_anyscale_job_wrapper.py:284
`error` at line 293 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. — release/ray_release/command_runner/_anyscale_job_wrapper.py:293
`error` at line 296 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. — release/ray_release/command_runner/_anyscale_job_wrapper.py:296
`error` at line 313 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. — release/ray_release/command_runner/_anyscale_job_wrapper.py:313
`error` at line 318 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. — release/ray_release/command_runner/_anyscale_job_wrapper.py:318
`error` at line 351 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. — release/ray_release/command_runner/_anyscale_job_wrapper.py:351
`error` at line 386 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. — release/ray_release/command_runner/_anyscale_job_wrapper.py:386
`error` at line 405 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. — release/ray_release/command_runner/_anyscale_job_wrapper.py:405
`error` at line 421 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. — release/ray_release/command_runner/_anyscale_job_wrapper.py:421
`info` at line 425 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. — release/ray_release/command_runner/_anyscale_job_wrapper.py:425
`error` at line 436 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. — release/ray_release/command_runner/_anyscale_job_wrapper.py:436
`error` at line 443 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. — release/ray_release/command_runner/_anyscale_job_wrapper.py:443
`info` at line 449 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. — release/ray_release/command_runner/_anyscale_job_wrapper.py:449
`error` at line 494 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. — release/ray_release/command_runner/_anyscale_job_wrapper.py:494
`error` at line 497 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. — release/ray_release/command_runner/_anyscale_job_wrapper.py:497
`info` at line 564 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. — release/ray_release/command_runner/_anyscale_job_wrapper.py:564
`info` at line 657 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. — release/ray_release/command_runner/_anyscale_job_wrapper.py:657
`debug` at line 41 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. — release/ray_release/command_runner/_prometheus_metrics.py:41
`warning` at line 51 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. — release/ray_release/command_runner/_prometheus_metrics.py:51
`warning` at line 58 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. — release/ray_release/command_runner/_prometheus_metrics.py:58
`warning` at line 64 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. — release/ray_release/command_runner/_prometheus_metrics.py:64
`error` at line 71 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. — release/ray_release/command_runner/_prometheus_metrics.py:71
`info` at line 202 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. — release/ray_release/command_runner/_prometheus_metrics.py:202
`error` at line 208 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. — release/ray_release/command_runner/_prometheus_metrics.py:208
`warning` at line 226 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. — release/ray_release/command_runner/_prometheus_metrics.py:226
`error` at line 233 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. — release/ray_release/command_runner/_prometheus_metrics.py:233
`warning` at line 160 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. — python/ray/__init__.py:160
`warning` at line 1634 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. — python/ray/actor.py:1634
`warning` at line 2655 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. — python/ray/actor.py:2655
Other · Code Health — Whether strict null checking is enabled and not undermined by heavy `!` assertion — TypeScript's `strictNullChecks` (which `strict` turns on) is what makes `string` exclude `null` and `undefined`, and the postfix `!` is the operator that silences it.
Method: Roslyn compiler-options scan: NullableContextOptions per project; null-forgiving (!) suppression density per 1k syntax nodes. Deterministic, adoption plus suppression penalty.
Do you agree with this assessment?
WCAG coverage — what static analysis assessed
Statically assessed 13 of 55 WCAG 2.2 Level A/AA success criteria (24%; ≈26% of the 50 WCAG 2.1 AA criteria for EN 301 549). The other 42 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 — 4 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.
D11 Test Reliability — 4 observation(s) recorded · This repository declares 4 of its own test(s) unreliable. The built-in reliability runner does not support this repository's ecosystem (.py, .tsx, .java, .js, .ts), so the suite was not re-run and no reliability score is given — these are the repository's own declarations, not our measurement.
X10 Duplicated predicate — 25 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X6 Hand-rolled structured-format parsing — 1 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X7 Silent fallback defaults — 13 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: this repository stores data through 'redis' (python/ray/serve/_private/broker.py:18) but declares no persisted model this check reads (Django, SQLAlchemy, SQLModel, Peewee, Tortoise and MongoEngine model fields, Alembic and Django migration columns, CREATE TABLE and ALTER TABLE … ADD columns in SQL files). Personal data may be written through raw SQL or a hosted backend, so whether its changes need an audit trail could not be established, and the trail's absence is not scored.
C4 Data Retention — Not assessed: this repository stores data through 'redis' (python/ray/serve/_private/broker.py:18) but declares no persisted model this check reads (Django, SQLAlchemy, SQLModel, Peewee, Tortoise and mongoengine model fields, Alembic and Django migration columns, SQL schemas). Personal data may be written through raw SQL or a hosted backend, so whether a retention limit applies here could not be established, and its absence is not scored.
C5 Data-Subject Rights — Not assessed: this repository stores data through 'redis' (python/ray/serve/_private/broker.py:18) but declares no persisted model this check reads (Django, SQLAlchemy, SQLModel, Peewee, Tortoise and mongoengine model fields, Alembic and Django migration columns, CREATE TABLE and ALTER TABLE … ADD columns in SQL files). Personal data may be written through raw SQL or a hosted backend, so whether data-subject rights apply here could not be established, and their absence is not scored.
P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 37 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.
AC4 Keyboard semantics — No interactive element found in the parsed markup — AC4 not applicable here.
AC5 ARIA correctness — No ARIA usage found in the parsed markup — AC5 not applicable here.
AX1 Captive dependencies — not 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
AX7 Slice cohesion — not applicable — not a vertical-slice architecture
AX9 CQS / query purity — no CQRS query handlers detected — query purity is not applicable to this codebase
AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
AXR1 Runtime accessibility — the dev server did not expose a crawlable HTTP endpoint in time — no runtime evidence 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.
D12 Dependency Hygiene — Not scored — 1 Maven/Gradle manifest(s) were read, stating a version for 0 dependency(ies) and leaving 0 to a parent or an imported BOM, but no build resolved the dependency graph, so the outdated signal was not established. NOT a finding that these dependencies are current or healthy.
D14 License Compliance — Python dependency closure larger than the licence pass walks
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# only; Java, JavaScript, Python, TypeScript not measured.
D22 Internal API Consistency — API consistency is measured on C# only; the exposed Python surface was not measured.
D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ projects each declaring an entity of their own. Aggregate roots were found in only one source directory (python), 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"]`.
D24 Comment Value — D24 reads C# and Visual Basic comments only — this repository's production source is .java, .py, .ts, .tsx, which was left unread. Not scored: this is a gap in the analyzer, not a verdict about this repository.
D25 ADR Conformance — no ADRs to check
D27 Navigability — D27 counts a call into the standard library or a dependency as unresolved for this repository's language (.py), so too few call sites counted as resolved to assess navigability. Not scored: this is a gap in the analyzer, not a verdict about this repository.
D32 Data Compliance (PII/GDPR) — 1 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.
D42 Runtime Threat Enforcement — The repository ships application workloads but no cluster-governance resources (CRDs, admission webhooks, or a committed policy engine). Runtime threat-detection (Falco/Tetragon) and admission control (Kyverno/OPA-Gatekeeper/PodSecurity) are cluster-OPERATOR controls owned by the platform, not shipped by an application repo/chart — nothing for this repo to assess.
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
ED1 Event-Driven — not scored — this repository shows none of the 3 signals this lens looks for
ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
ES1 Event Sourcing — not scored — this repository shows none of the 3 signals this lens looks for
GD1 Unfinished & placeholder code — no source files were read — this check reads C#, F#, JavaScript/TypeScript, Dart, Ruby and Scala, and none was read for this repository's product. That is a limit of the analyzer, not a finding about your code.
IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
M4 Documentation accuracy — Not applicable: the 200 current-state document(s) make no claim of a kind M4 checks. 219 claim(s) of kinds M4 does not check were not checked (path 58, command argument 12, environment variable 137, setting 2, route 8, cd 2); M4 checks only links and versions.
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 — Alembic, Peewee, SQLAlchemy is declared, but the schema-migration mechanism could not be identified. Our limit, not a verdict on this repository.
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.
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.
SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
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.
Orphaned knowledge REDACTED:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge python/ray/tune/progress_reporter.py:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge REDACTED:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge python/ray/rllib/core/models/configs.py:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge python/ray/rllib/policy/torch_policy.py:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge release/nightly_tests/dataset/dataset_benchmark_util.py:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge python/ray/rllib/policy/tf_policy.py:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge python/ray/rllib/policy/eager_tf_policy.py:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge python/ray/rllib/policy/dynamic_tf_policy_v2.py:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge python/ray/rllib/algorithms/dreamerv3/torch/dreamerv3_torch_learner.py:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge python/ray/rllib/policy/eager_tf_policy_v2.py:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge python/ray/air/execution/_internal/actor_manager.py:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge REDACTED:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge python/ray/tune/experimental/output.py:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge python/ray/autoscaler/_private/aws/cloudwatch/cloudwatch_helper.py:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge python/ray/rllib/callbacks/callbacks.py:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge python/ray/rllib/utils/runners/runner_group.py:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge release/nightly_tests/dataset/training_ingest_benchmark.py:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge python/ray/rllib/models/tf/tf_action_dist.py:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge python/ray/data/_internal/datasource/zarrv2_datasource.py:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge python/ray/autoscaler/_private/vsphere/cluster_operator_client.py:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge python/ray/autoscaler/_private/gcp/node.py:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge REDACTED:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge python/ray/rllib/algorithms/dreamerv3/torch/models/dreamer_model.py:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge python/ray/rllib/models/torch/torch_action_dist.py:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
D11 · Test Reliability· Test declared unreliable · ×4
Test declared unreliable: test_memory_release_shuffle python/ray/data/tests/test_optimize.py:110— This test is disabled or skipped with a reason naming unreliability — the repository's own words: "Flaky, see https://github.com/ray-project/ray/issues/24757". A test that is skipped for flakiness is neither passing nor protecting the code it covers; either stabilise it or delete it, but do not leave it disabled indefinitely. (Found by reading the repository's own test source — the suite itself was not re-run, since the reliability runner does not support this ecosystem.)
Test declared unreliable: test_http_access_log_in_stderr python/ray/serve/tests/test_logging.py:113— This test is disabled or skipped with a reason naming unreliability — the repository's own words: "The test for JSON log format is flaky, skipping for now.". A test that is skipped for flakiness is neither passing nor protecting the code it covers; either stabilise it or delete it, but do not leave it disabled indefinitely. (Found by reading the repository's own test source — the suite itself was not re-run, since the reliability runner does not support this ecosystem.)
Test declared unreliable: test_reconstruction python/ray/tests/test_streaming_generator_2.py:52— This test is disabled or skipped with a reason naming unreliability — the repository's own words: "This test is flaky on darwin as of https://github.com/ray-project/ray/pull/53999.". A test that is skipped for flakiness is neither passing nor protecting the code it covers; either stabilise it or delete it, but do not leave it disabled indefinitely. (Found by reading the repository's own test source — the suite itself was not re-run, since the reliability runner does not support this ecosystem.)
Test declared unreliable: test_searcher_save_restore python/ray/tune/tests/execution/test_controller_search_alg_integration.py:283— This test is disabled or skipped with a reason naming unreliability — the repository's own words: "This test is currently flaky as it can fail due to timing issues.". A test that is skipped for flakiness is neither passing nor protecting the code it covers; either stabilise it or delete it, but do not leave it disabled indefinitely. (Found by reading the repository's own test source — the suite itself was not re-run, since the reliability runner does not support this ecosystem.)
AC2 · Forms & labels· <button> with no accessible text · ×1
<button> with no accessible text doc/source/_static/js/assistant.js:19— 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· <textarea> without a programmatic label · ×1
<textarea> without a programmatic label doc/source/_static/js/assistant.js:29— 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.
Boundary-crossing change coupling: vllm_engine.py ↔ run_llm_serve_test_and_bms.py python/ray/llm/_internal/serve/engines/vllm/vllm_engine.py:1— `python/ray/llm/_internal/serve/engines/vllm/vllm_engine.py` (context python) and `release/llm_tests/serve/run_llm_serve_test_and_bms.py` (context release) 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, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 `d6be75f5` [Serve.llm] Make llm serve endpoints compatible with vLLM serve front… (at that commit the file was still `python/ray/llm/_internal/serve/deployments/llm/vllm/vllm_engine.py`); `a8722868` [llm] bump vllm to 0.9.0.1 (#53443) (at that commit the file was still `python/ray/llm/_internal/serve/deployments/llm/vllm/vllm_engine.py`); `f9f0129b` [serve.llm] release tests for 1p1d (#53190) (at that commit the file was still `python/ray/llm/_internal/serve/deployments/llm/vllm/vllm_engine.py`) — run `git show` on any of them.
Unlisted import 'highlight.js' python/ray/dashboard/client/src/components/LogView/LogVirtualView.tsx:3— Imported but not declared in any reachable package.json — installs work only by hoisting accident.
TodoComment release/train_tests/preemption/test_preemption_benchmark.py:215— # TODO: make the grace period configurable. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment release/train_tests/multinode_persistence/test_v2_persistence.py:216— # TODO: This barrier before raising is a workaround to deflake the test. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment python/ray/train/v2/tests/test_persistence.py:216— # TODO: This barrier before raising is a workaround to deflake the test. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment release/train_tests/benchmark/benchmark_factory.py:18— # TODO: These can probably be moved to the train loop runner, — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment release/train_tests/benchmark/runner.py:145— # TODO: Compare this baseline to the data checkpointing approach once we have it. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment release/train_tests/benchmark/runner.py:167— # TODO: This is slightly off if the last batch is a partial batch (if drop_last=False) — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment release/train_tests/benchmark/runner.py:340— # TODO: These metrics should be aggregated across training workers. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment release/train_tests/benchmark/runner.py:356— # TODO: Ray Data can provide these throughput metrics automatically. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment release/train_tests/benchmark/recsys/criteo.py:222— # TODO: This will not scale well for the full dataset, since this dict might be 10s of GBs, — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment release/train_tests/benchmark/recsys/criteo.py:253— # TODO: Need to shuffle the data. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment release/train_tests/benchmark/recsys/criteo.py:261— # TODO: This needs to be optimized in order to run on the full dataset. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment release/train_tests/benchmark/recsys/recsys_factory.py:46— # TODO: Use the train dataset for validation as well. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment release/train_tests/benchmark/recsys/torchrec_runner.py:29— # TODO: This code depends on the model having a fused_optimizer, — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment release/train_tests/benchmark/image_classification/parquet/parquet_iterable_dataset.py:25— # TODO Look into https://github.com/webdataset/webdataset for more canonical way to do data
TodoComment release/train_tests/benchmark/image_classification/jpeg/factory.py:88— # TODO: The validation dataset directory is not partitioned by class. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment release/train_tests/benchmark/image_classification/jpeg/factory.py:202— # TODO: IMAGENET_JPEG_SPLIT_S3_DIRS["val"] does not have the label — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment release/train_tests/benchmark/core/experiment_config.py:61— # are truncated/padded to this length (see text_dataset; packing is a TODO). — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment release/train_tests/benchmark/core/metrics.py:133— # underestimate. TODO: model the recurrent-state-update FLOPs per family. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment release/train_tests/async_checkpointing_validation_benchmark/test_async_checkpointing_validation_benchmark.py:464— # TODO: consider measuring how long it takes to kick off validation, — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment release/train_tests/async_checkpointing_validation_benchmark/test_async_checkpointing_validation_benchmark.py:727— # TODO: consider correctness checks like validating that local checkpoints get deleted — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment release/train_tests/async_checkpointing_validation_benchmark/test_async_checkpointing_validation_benchmark.py:728— # TODO: track validation startup metrics: schedule validation task, autoscale nodes, — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment release/serve_tests/workloads/multi_deployment_1k_noop_replica.py:57— # TODO:(jiaodong) We should investigate and change this back to 1k — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment release/serve_tests/workloads/multi_deployment_1k_noop_replica.py:61— # TODO(simon): we should change this back to 100. But due to long poll issue — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment release/serve_tests/workloads/multi_deployment_1k_noop_replica.py:175— # TODO:(jiaodong) What's the best number to use here ? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment REDACTED:51— # TODO: Ray client didn't work with releaser script yet because — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FileTooLong: _private/deployment_state.py python/ray/serve/_private/deployment_state.py— FileTooLong — 4461 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 3961 over it, 8.92× 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 — 3445 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2945 over it, 6.89× 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 — 3105 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2605 over it, 6.21× 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: algorithms/algorithm_config.py python/ray/rllib/algorithms/algorithm_config.py— FileTooLong — 3088 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2588 over it, 6.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: REDACTED REDACTED— FileTooLong — 2803 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2303 over it, 5.61× 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: data/read_api.py python/ray/data/read_api.py— FileTooLong — 2617 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2117 over it, 5.23× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: REDACTED REDACTED— FileTooLong — 2244 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1744 over it, 4.49× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: scripts/scripts.py python/ray/scripts/scripts.py— FileTooLong — 2005 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1505 over it, 4.01× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: ray/actor.py python/ray/actor.py— FileTooLong — 1715 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1215 over it, 3.43× 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: _internal/stats.py python/ray/data/_internal/stats.py— FileTooLong — 1589 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1089 over it, 3.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: REDACTED REDACTED— FileTooLong — 1546 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1046 over it, 3.09× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: REDACTED REDACTED— FileTooLong — 1457 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 957 over it, 2.91× 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: _private/services.py python/ray/_private/services.py— FileTooLong — 1430 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 930 over it, 2.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: serve/schema.py python/ray/serve/schema.py— FileTooLong — 1375 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 875 over it, 2.75× 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: execution/tune_controller.py python/ray/tune/execution/tune_controller.py— FileTooLong — 1360 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 860 over it, 2.72× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: REDACTED REDACTED— FileTooLong — 1345 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 845 over it, 2.69× 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: _private/router.py python/ray/serve/_private/router.py— FileTooLong — 1323 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 823 over it, 2.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: _private/application_state.py python/ray/serve/_private/application_state.py— FileTooLong — 1291 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 791 over it, 2.58× 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 — 1270 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 770 over it, 2.54× 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: util/tpu.py python/ray/util/tpu.py— FileTooLong — 1244 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 744 over it, 2.49× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: REDACTED REDACTED— FileTooLong — 1241 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 741 over it, 2.48× 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 — 1229 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 729 over it, 2.46× 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: _private/commands.py python/ray/autoscaler/_private/commands.py— FileTooLong — 1228 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 728 over it, 2.46× 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: v2/scheduler.py python/ray/autoscaler/v2/scheduler.py— FileTooLong — 1214 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 714 over it, 2.43× 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 — 1213 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 713 over it, 2.43× 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.
TooManyMethods: Dataset REDACTED:272— TooManyMethods — 131 methods. The bar is 30 methods; this is 101 over it, 4.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.
TooManyMethods: DeploymentState python/ray/serve/_private/deployment_state.py:3213— TooManyMethods — 96 methods. The bar is 30 methods; this is 66 over it, 3.20× 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: ServeController REDACTED:141— TooManyMethods — 83 methods. The bar is 30 methods; this is 53 over it, 2.77× 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: AlgorithmConfig python/ray/rllib/algorithms/algorithm_config.py:109— TooManyMethods — 75 methods. The bar is 30 methods; this is 45 over it, 2.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: TuneController python/ray/tune/execution/tune_controller.py:72— TooManyMethods — 74 methods. The bar is 30 methods; this is 44 over it, 2.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: Algorithm REDACTED:211— TooManyMethods — 69 methods. The bar is 30 methods; this is 39 over it, 2.30× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Replica REDACTED:1080— TooManyMethods — 60 methods. The bar is 30 methods; this is 30 over it, 2.00× 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: Node REDACTED:73— TooManyMethods — 56 methods. The bar is 30 methods; this is 26 over it, 1.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: Learner python/ray/rllib/core/learner/learner.py:151— 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: PhysicalOperator REDACTED:585— TooManyMethods — 52 methods. The bar is 30 methods; this is 22 over it, 1.73× 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: ReporterAgent REDACTED:501— 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: RolloutWorker REDACTED:152— TooManyMethods — 47 methods. The bar is 30 methods; this is 17 over it, 1.57× 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: EagerTFPolicyV2 python/ray/rllib/policy/eager_tf_policy_v2.py:59— 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: TFPolicy python/ray/rllib/policy/tf_policy.py:42— 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: DeploymentStateManager python/ray/serve/_private/deployment_state.py:6644— 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: Policy REDACTED:183— TooManyMethods — 43 methods. The bar is 30 methods; this is 13 over it, 1.43× 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: AbstractRayRuntime java/runtime/src/main/java/io/ray/runtime/AbstractRayRuntime.java:62— TooManyMethods — 42 methods. The bar is 30 methods; this is 12 over it, 1.40× 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: Trial python/ray/tune/experiment/trial.py:216— TooManyMethods — 42 methods. The bar is 30 methods; this is 12 over it, 1.40× 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: Worker REDACTED:155— TooManyMethods — 42 methods. The bar is 30 methods; this is 12 over it, 1.40× 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: BlockAccessor python/ray/data/block.py:442— 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: CloudwatchHelper python/ray/autoscaler/_private/aws/cloudwatch/cloudwatch_helper.py:31— TooManyMethods — 38 methods. The bar is 30 methods; this is 8 over it, 1.27× 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: HashShufflingOperatorBase REDACTED:495— 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: TorchPolicyV2 python/ray/rllib/policy/torch_policy_v2.py:63— 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: DeploymentConfig java/serve/src/main/java/io/ray/serve/config/DeploymentConfig.java:15— TooManyMethods — 36 methods. The bar is 30 methods; this is 6 over it, 1.20× 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: CompiledDAG python/ray/dag/compiled_dag_node.py:813— TooManyMethods — 36 methods. The bar is 30 methods; this is 6 over it, 1.20× 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.
Outbound HTTP without resilience ci/build/get_build_info.py:24— `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 ci/build/get_build_info.py:32— `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 ci/build/get_build_info.py:75— `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 ci/ray_ci/automation/docker_tags_lib.py:272— `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 ci/ray_ci/automation/docker_tags_lib.py:286— `requests.post(` 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 ci/ray_ci/automation/docker_tags_lib.py:333— `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 ci/ray_ci/automation/docker_tags_lib.py:344— `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 ci/ray_ci/automation/docker_tags_lib.py:368— `requests.delete(` 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 ci/ray_ci/automation/docker_tags_lib.py:411— `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 ci/ray_ci/automation/docker_tags_lib.py:455— `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 doc/load_doc_cache.py:47— `requests.head(` 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 doc/load_doc_cache.py:65— `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 doc/source/core/doc_code/actor-http-server.py:31— `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 doc/source/custom_directives.py:138— `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 doc/source/llm/doc_code/serve/transcription/transcription_example.py:81— `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 doc/source/serve/doc_code/app_builder.py:31— `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 doc/source/serve/doc_code/app_builder.py:64— `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 doc/source/serve/doc_code/asyncio_best_practices.py:62— `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 doc/source/serve/doc_code/asyncio_best_practices.py:86— `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 doc/source/serve/doc_code/asyncio_best_practices.py:236— `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 doc/source/serve/doc_code/autoscale_model_comp_example.py:47— `requests.post(` 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 doc/source/serve/doc_code/aws_neuron_core_inference_serve.py:99— `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 doc/source/serve/doc_code/aws_neuron_core_inference_serve_stable_diffusion.py:66— `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 doc/source/serve/doc_code/batching_guide.py:93— `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 doc/source/serve/doc_code/batching_guide.py:142— `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.
Hotspot: python/ray/data/read_api.py python/ray/data/read_api.py:1667— python/ray/data/read_api.py changed 28 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 26 in read_api.read_parquet at line 1667. 4 of those changes were fix/bug commits, and the other 24 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-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:00:43 +00:00' --until='2026-10-24 17:00:43 +00:00' --full-history --no-merges -- python/ray/data/read_api.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:1447— REDACTED changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 62 in worker.init at line 1447. 1 of those changes was a fix/bug commit, and the other 7 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-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:00:43 +00:00' --until='2026-10-24 17:00:43 +00: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: REDACTED REDACTED:435— REDACTED changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 45 in image_utils.extract_tar_layer at line 435. 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-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:00:43 +00:00' --until='2026-10-24 17:00:43 +00: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: python/ray/serve/_private/deployment_state.py python/ray/serve/_private/deployment_state.py:7280— python/ray/serve/_private/deployment_state.py changed 15 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 30 in DeploymentStateManager.update at line 7280. 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-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:00:43 +00:00' --until='2026-10-24 17:00:43 +00:00' --full-history --no-merges -- python/ray/serve/_private/deployment_state.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: python/ray/experimental/sandbox/backend/gvisor.py python/ray/experimental/sandbox/backend/gvisor.py:564— python/ray/experimental/sandbox/backend/gvisor.py changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 24 in GVisorSandboxBackend._start_sandbox at line 564. 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-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:00:43 +00:00' --until='2026-10-24 17:00:43 +00:00' --full-history --no-merges -- python/ray/experimental/sandbox/backend/gvisor.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:3122— REDACTED changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 27 in Replica._direct_ingress_asgi at line 3122. 1 of those changes was a fix/bug commit, and the other 10 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-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:00:43 +00:00' --until='2026-10-24 17:00:43 +00: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: python/ray/serve/_private/common.py python/ray/serve/_private/common.py:328— python/ray/serve/_private/common.py changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 49 in DeploymentStatusInfo.handle_transition at line 328. 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-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:00:43 +00:00' --until='2026-10-24 17:00:43 +00:00' --full-history --no-merges -- python/ray/serve/_private/common.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:85— REDACTED changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 67 in Node.__init__ at line 85. 1 of those changes was a fix/bug commit, and the other 3 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-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:00:43 +00:00' --until='2026-10-24 17:00:43 +00: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: python/ray/serve/_private/application_state.py python/ray/serve/_private/application_state.py:1878— python/ray/serve/_private/application_state.py changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 41 in application_state.override_deployment_info at line 1878. 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-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:00:43 +00:00' --until='2026-10-24 17:00:43 +00:00' --full-history --no-merges -- python/ray/serve/_private/application_state.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: python/ray/data/_internal/stats.py python/ray/data/_internal/stats.py:1774— python/ray/data/_internal/stats.py changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 30 in OperatorStatsSummary.from_block_metadata at line 1774. 1 of those changes was a fix/bug commit, and the other 7 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-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:00:43 +00:00' --until='2026-10-24 17:00:43 +00:00' --full-history --no-merges -- python/ray/data/_internal/stats.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: python/ray/experimental/sandbox/image_manager.py python/ray/experimental/sandbox/image_manager.py:368— python/ray/experimental/sandbox/image_manager.py changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 38 in ImageManager.create_oci_spec at line 368. 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-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:00:43 +00:00' --until='2026-10-24 17:00:43 +00:00' --full-history --no-merges -- python/ray/experimental/sandbox/image_manager.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: python/ray/rllib/core/learner/learner.py python/ray/rllib/core/learner/learner.py:1259— python/ray/rllib/core/learner/learner.py changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 45 in Learner._create_iterator_if_necessary at line 1259. 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-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:00:43 +00:00' --until='2026-10-24 17:00:43 +00:00' --full-history --no-merges -- python/ray/rllib/core/learner/learner.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: python/ray/rllib/examples/utils.py python/ray/rllib/examples/utils.py:380— python/ray/rllib/examples/utils.py changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 65 in utils.run_rllib_example_script_experiment at line 380. 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-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:00:43 +00:00' --until='2026-10-24 17:00:43 +00:00' --full-history --no-merges -- python/ray/rllib/examples/utils.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: python/ray/data/_internal/datasource_v2/common/file_reader.py python/ray/data/_internal/datasource_v2/common/file_reader.py:186— python/ray/data/_internal/datasource_v2/common/file_reader.py changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 23 in FileReader.read at line 186. 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-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:00:43 +00:00' --until='2026-10-24 17:00:43 +00:00' --full-history --no-merges -- python/ray/data/_internal/datasource_v2/common/file_reader.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:1624— REDACTED changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 31 in ReporterAgent._to_records at line 1624. 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-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:00:43 +00:00' --until='2026-10-24 17:00:43 +00: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: python/ray/data/_internal/planner/plan_all_to_all_op.py python/ray/data/_internal/planner/plan_all_to_all_op.py:390— python/ray/data/_internal/planner/plan_all_to_all_op.py changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 17 in plan_all_to_all_op.plan_all_to_all_op at line 390. 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-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:00:43 +00:00' --until='2026-10-24 17:00:43 +00:00' --full-history --no-merges -- python/ray/data/_internal/planner/plan_all_to_all_op.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: python/ray/experimental/sandbox/config.py python/ray/experimental/sandbox/config.py:356— python/ray/experimental/sandbox/config.py changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 20 in SandboxConfig.__post_init__ at line 356. 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-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:00:43 +00:00' --until='2026-10-24 17:00:43 +00:00' --full-history --no-merges -- python/ray/experimental/sandbox/config.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: python/ray/util/tpu.py python/ray/util/tpu.py:962— python/ray/util/tpu.py changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 23 in tpu.run_on_slice at line 962. 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-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:00:43 +00:00' --until='2026-10-24 17:00:43 +00:00' --full-history --no-merges -- python/ray/util/tpu.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: python/ray/serve/deployment.py python/ray/serve/deployment.py:222— python/ray/serve/deployment.py changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 45 in Deployment.options at line 222. 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-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:00:43 +00:00' --until='2026-10-24 17:00:43 +00:00' --full-history --no-merges -- python/ray/serve/deployment.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:184— REDACTED changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 15 in LLMRouter.route at line 184. 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-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:00:43 +00:00' --until='2026-10-24 17:00:43 +00: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: python/ray/serve/_private/request_router/request_router.py python/ray/serve/_private/request_router/request_router.py:1267— python/ray/serve/_private/request_router/request_router.py changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 18 in RequestRouter._fulfill_pending_requests at line 1267. 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-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:00:43 +00:00' --until='2026-10-24 17:00:43 +00:00' --full-history --no-merges -- python/ray/serve/_private/request_router/request_router.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: python/ray/autoscaler/v2/scheduler.py python/ray/autoscaler/v2/scheduler.py:1722— python/ray/autoscaler/v2/scheduler.py changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 26 in ResourceDemandScheduler._try_schedule at line 1722. 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-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:00:43 +00:00' --until='2026-10-24 17:00:43 +00:00' --full-history --no-merges -- python/ray/autoscaler/v2/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: python/ray/serve/api.py python/ray/serve/api.py:541— python/ray/serve/api.py changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 16 in api.deployment at line 541. 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-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:00:43 +00:00' --until='2026-10-24 17:00:43 +00:00' --full-history --no-merges -- python/ray/serve/api.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: python/ray/data/_internal/planner/_obstore_download.py python/ray/data/_internal/planner/_obstore_download.py:1210— python/ray/data/_internal/planner/_obstore_download.py changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 28 in _obstore_download._download_uris_with_obstore at line 1210. 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-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:00:43 +00:00' --until='2026-10-24 17:00:43 +00:00' --full-history --no-merges -- python/ray/data/_internal/planner/_obstore_download.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: python/ray/data/_internal/execution/operators/join.py python/ray/data/_internal/execution/operators/join.py:227— python/ray/data/_internal/execution/operators/join.py changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 18 in join._join_tables_iter at line 227. 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-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:00:43 +00:00' --until='2026-10-24 17:00:43 +00:00' --full-history --no-merges -- python/ray/data/_internal/execution/operators/join.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.
+ 14 more in this group — see findings.md.
AC2 · Forms & labels· <Autocomplete> field component without a label · ×28
<Autocomplete> field component without a label python/ray/dashboard/client/src/components/ActorTable.tsx:366— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Autocomplete> field component without a label python/ray/dashboard/client/src/components/ActorTable.tsx:381— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Autocomplete> field component without a label python/ray/dashboard/client/src/components/ActorTable.tsx:397— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Autocomplete> field component without a label python/ray/dashboard/client/src/components/ActorTable.tsx:412— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Autocomplete> field component without a label python/ray/dashboard/client/src/components/DataOverviewTable.tsx:97— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Autocomplete> field component without a label python/ray/dashboard/client/src/components/EventTable.tsx:142— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Autocomplete> field component without a label python/ray/dashboard/client/src/components/EventTable.tsx:158— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Autocomplete> field component without a label python/ray/dashboard/client/src/components/EventTable.tsx:174— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Autocomplete> field component without a label python/ray/dashboard/client/src/components/EventTable.tsx:190— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Autocomplete> field component without a label python/ray/dashboard/client/src/components/PlacementGroupTable.tsx:99— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Autocomplete> field component without a label python/ray/dashboard/client/src/components/PlacementGroupTable.tsx:111— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Autocomplete> field component without a label python/ray/dashboard/client/src/components/PlacementGroupTable.tsx:121— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Autocomplete> field component without a label python/ray/dashboard/client/src/components/PlacementGroupTable.tsx:134— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Autocomplete> field component without a label python/ray/dashboard/client/src/components/SearchComponent.tsx:154— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Autocomplete> field component without a label python/ray/dashboard/client/src/components/TaskTable.tsx:103— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Autocomplete> field component without a label python/ray/dashboard/client/src/components/TaskTable.tsx:116— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Autocomplete> field component without a label python/ray/dashboard/client/src/components/TaskTable.tsx:126— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Autocomplete> field component without a label python/ray/dashboard/client/src/components/TaskTable.tsx:137— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Autocomplete> field component without a label python/ray/dashboard/client/src/components/TaskTable.tsx:150— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Autocomplete> field component without a label python/ray/dashboard/client/src/components/TaskTable.tsx:160— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Autocomplete> field component without a label python/ray/dashboard/client/src/pages/events/PlatformEvents.tsx:135— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Autocomplete> field component without a label python/ray/dashboard/client/src/pages/events/PlatformEvents.tsx:146— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Autocomplete> field component without a label python/ray/dashboard/client/src/pages/events/PlatformEvents.tsx:157— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Autocomplete> field component without a label python/ray/dashboard/client/src/pages/job/index.tsx:129— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Autocomplete> field component without a label python/ray/dashboard/client/src/pages/serve/ServeApplicationDetailPage.tsx:160— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
FunctionTooLong: ActorTable.ActorTable python/ray/dashboard/client/src/components/ActorTable.tsx:86— FunctionTooLong — ActorTable runs 631 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 531 over it, 6.31× 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: App.App python/ray/dashboard/client/src/App.tsx:162— FunctionTooLong — App runs 332 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 232 over it, 3.32× 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: TaskTable.TaskTable python/ray/dashboard/client/src/components/TaskTable.tsx:42— FunctionTooLong — TaskTable runs 260 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 160 over it, 2.60× 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: ServeEntityLogViewer.ServeEntityLogViewer python/ray/dashboard/client/src/pages/serve/ServeEntityLogViewer.tsx:32— FunctionTooLong — ServeEntityLogViewer runs 225 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 125 over it, 2.25× 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: PlatformEvents.PlatformEvents python/ray/dashboard/client/src/pages/events/PlatformEvents.tsx:35— FunctionTooLong — PlatformEvents runs 216 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 116 over it, 2.16× 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: EventTable.EventTable python/ray/dashboard/client/src/components/EventTable.tsx:115— FunctionTooLong — EventTable runs 215 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 115 over it, 2.15× 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: ActorDetail.ActorDetailPage python/ray/dashboard/client/src/pages/actor/ActorDetail.tsx:53— FunctionTooLong — ActorDetailPage runs 173 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 73 over it, 1.73× 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: index.Nodes REDACTED:244— FunctionTooLong — Nodes 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.
FunctionTooLong: JobDetail.JobDetailChartsPage python/ray/dashboard/client/src/pages/job/JobDetail.tsx:52— FunctionTooLong — JobDetailChartsPage runs 169 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 69 over it, 1.69× 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: LogVirtualView.LogVirtualView python/ray/dashboard/client/src/components/LogView/LogVirtualView.tsx:197— FunctionTooLong — LogVirtualView runs 168 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 68 over it, 1.68× 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: TaskPage.TaskPageContents python/ray/dashboard/client/src/pages/task/TaskPage.tsx:67— FunctionTooLong — TaskPageContents runs 158 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 58 over it, 1.58× 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: ProgressBar.ProgressBar python/ray/dashboard/client/src/components/ProgressBar/ProgressBar.tsx:73— FunctionTooLong — ProgressBar runs 157 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 57 over it, 1.57× 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: PlacementGroupTable.PlacementGroupTable python/ray/dashboard/client/src/components/PlacementGroupTable.tsx:68— FunctionTooLong — PlacementGroupTable runs 155 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 55 over it, 1.55× 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: NodeRow.NodeRow python/ray/dashboard/client/src/pages/node/NodeRow.tsx:51— FunctionTooLong — NodeRow runs 148 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 48 over it, 1.48× 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: ServeApplicationDetailPage.ServeApplicationDetailPage python/ray/dashboard/client/src/pages/serve/ServeApplicationDetailPage.tsx:41— FunctionTooLong — ServeApplicationDetailPage runs 148 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 48 over it, 1.48× 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: ServeDeploymentDetailPage.ServeDeploymentDetailPage python/ray/dashboard/client/src/pages/serve/ServeDeploymentDetailPage.tsx:39— FunctionTooLong — ServeDeploymentDetailPage runs 143 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 43 over it, 1.43× 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: ServeMetricsSection.ServeMetricsSection python/ray/dashboard/client/src/pages/serve/ServeMetricsSection.tsx:79— FunctionTooLong — ServeMetricsSection runs 143 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 43 over it, 1.43× 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: Metrics.Metrics python/ray/dashboard/client/src/pages/metrics/Metrics.tsx:96— FunctionTooLong — Metrics runs 131 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 31 over it, 1.31× 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: ProfilingLink.ProfilingParamsDialog python/ray/dashboard/client/src/common/ProfilingLink.tsx:188— FunctionTooLong — ProfilingParamsDialog runs 126 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 26 over it, 1.26× 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: SearchComponent.SearchTimezone python/ray/dashboard/client/src/components/SearchComponent.tsx:98— FunctionTooLong — SearchTimezone runs 121 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 21 over it, 1.21× 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: AdvancedProgressBar.AdvancedProgressBarSegment python/ray/dashboard/client/src/pages/job/AdvancedProgressBar/AdvancedProgressBar.tsx:78— FunctionTooLong — AdvancedProgressBarSegment runs 117 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 17 over it, 1.17× 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: JobRow.JobRow python/ray/dashboard/client/src/pages/job/JobRow.tsx:21— FunctionTooLong — JobRow 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.
FunctionTooLong: index.JobList python/ray/dashboard/client/src/pages/job/index.tsx:59— FunctionTooLong — JobList 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.
FunctionTooLong: MainNavLayout.MainNavBar python/ray/dashboard/client/src/pages/layout/MainNavLayout.tsx:120— FunctionTooLong — MainNavBar runs 106 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 6 over it, 1.06× 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: NodeRow.WorkerRow python/ray/dashboard/client/src/pages/node/NodeRow.tsx:237— FunctionTooLong — WorkerRow runs 105 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 5 over it, 1.05× 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 (10 lines × 2) python/ray/_private/arrow_serialization.py:417— python/ray/_private/arrow_serialization.py:417-426 | python/ray/_private/arrow_serialization.py:449-458 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) python/ray/_private/ray_experimental_perf.py:272— python/ray/_private/ray_experimental_perf.py:272-281 | python/ray/_private/ray_experimental_perf.py:288-297 — both copies are in the same file, so extract the 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 `python/ray/_private/ray_experimental_perf.py:272` it begins part-way through the construct above it, so those 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) python/ray/_private/ray_experimental_perf.py:282— python/ray/_private/ray_experimental_perf.py:282-291 | python/ray/_private/ray_experimental_perf.py:299-308 — both copies are in the same file, so extract the 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) python/ray/air/execution/_internal/actor_manager.py:842— python/ray/air/execution/_internal/actor_manager.py:842-851 | python/ray/air/execution/_internal/actor_manager.py:853-862 — both copies are in the same file, so extract the 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) python/ray/dashboard/http_server_agent.py:138— python/ray/dashboard/http_server_agent.py:138-147 | python/ray/dashboard/http_server_head.py:491-500 — 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 `python/ray/dashboard/http_server_head.py:491` it begins part-way through the construct above it, so those 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) python/ray/dashboard/modules/data/data_head.py:153— python/ray/dashboard/modules/data/data_head.py:153-162 | python/ray/dashboard/modules/metrics/metrics_head.py:465-474 — 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) python/ray/data/_internal/planner/_obstore_download.py:1416— python/ray/data/_internal/planner/_obstore_download.py:1416-1425 | python/ray/data/_internal/planner/_obstore_download.py:1459-1468 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) python/ray/rllib/algorithms/appo/appo_tf_policy.py:155— python/ray/rllib/algorithms/appo/appo_tf_policy.py:155-164 | python/ray/rllib/algorithms/impala/impala_tf_policy.py:370-379 — 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) python/ray/rllib/evaluation/collectors/simple_list_collector.py:442— python/ray/rllib/evaluation/collectors/simple_list_collector.py:442-451 | python/ray/rllib/evaluation/sample_batch_builder.py:171-180 — 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) python/ray/rllib/models/preprocessors.py:280— python/ray/rllib/models/preprocessors.py:280-289 | python/ray/rllib/models/preprocessors.py:319-328 — both copies are in the same file, so extract the 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 (10 lines × 2) python/ray/rllib/offline/estimators/importance_sampling.py:36— python/ray/rllib/offline/estimators/importance_sampling.py:36-45 | python/ray/rllib/offline/estimators/weighted_importance_sampling.py:106-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 (10 lines × 2) python/ray/rllib/policy/torch_policy.py:177— python/ray/rllib/policy/torch_policy.py:177-186 | python/ray/rllib/policy/torch_policy_v2.py:103-112 — before extracting anything, compare `python/ray/rllib/policy/torch_policy.py` and `python/ray/rllib/policy/torch_policy_v2.py` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 513 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 2) python/ray/train/v2/_internal/callbacks/env_callback.py:30— python/ray/train/v2/_internal/callbacks/env_callback.py:30-39 | python/ray/tune/utils/callback.py:163-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. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (10 lines × 2) REDACTED:454— REDACTED:454-463 | python/ray/tune/search/hyperopt/hyperopt_search.py:550-559 — 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 (10 lines × 2) python/ray/tune/search/sample.py:221— python/ray/tune/search/sample.py:221-230 | python/ray/tune/search/sample.py:354-363 — both copies are in the same file, so extract the 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) python/ray/data/_internal/logging.py:99— python/ray/data/_internal/logging.py:99-108 | python/ray/train/v2/_internal/logging/logging.py:296-308 — 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) python/ray/rllib/algorithms/appo/appo_learner.py:78— python/ray/rllib/algorithms/appo/appo_learner.py:78-87 | python/ray/rllib/algorithms/dqn/dqn_learner.py:75-84 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (10 lines × 2) python/ray/rllib/models/tf/layers/skip_connection.py:38— python/ray/rllib/models/tf/layers/skip_connection.py:38-47 | python/ray/rllib/models/torch/modules/skip_connection.py:36-45 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (10 lines × 2) python/ray/data/_internal/datasource/csv_datasink.py:20— python/ray/data/_internal/datasource/csv_datasink.py:20-29 | python/ray/data/_internal/datasource/json_datasink.py:20-29 — 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) python/ray/train/_internal/storage.py:500— python/ray/train/_internal/storage.py:500-509 | python/ray/train/v2/_internal/execution/storage.py:431-440 — before extracting anything, compare `python/ray/train/_internal/storage.py` and `python/ray/train/v2/_internal/execution/storage.py` as WHOLE FILES: this scan already matched 8 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. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 2) python/ray/train/_internal/worker_group.py:334— python/ray/train/_internal/worker_group.py:334-346 | python/ray/util/actor_group.py:193-202 — 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) java/runtime/src/main/java/io/ray/runtime/serializer/RayExceptionSerializer.java:25— java/runtime/src/main/java/io/ray/runtime/serializer/RayExceptionSerializer.java:25-34 | java/runtime/src/main/java/io/ray/runtime/serializer/RayExceptionSerializer.java:38-47 — both copies are in the same file, so extract the 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 `java/runtime/src/main/java/io/ray/runtime/serializer/RayExceptionSerializer.java:25` 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) java/serve/src/main/java/io/ray/serve/config/DeploymentConfig.java:253— java/serve/src/main/java/io/ray/serve/config/DeploymentConfig.java:253-262 | java/serve/src/main/java/io/ray/serve/config/DeploymentConfig.java:277-286 — both copies are in the same file, so extract the 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 `java/serve/src/main/java/io/ray/serve/config/DeploymentConfig.java:253` it begins part-way through the construct above it, so those 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, `java/serve/src/main/java/io/ray/serve/config/DeploymentConfig.java:252` calls `setVersion` and `java/serve/src/main/java/io/ray/serve/config/DeploymentConfig.java:276` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 2) release/air_tests/air_benchmarks/workloads/tensorflow_benchmark.py:207— release/air_tests/air_benchmarks/workloads/tensorflow_benchmark.py:207-216 | release/air_tests/air_benchmarks/workloads/torch_benchmark.py:369-378 — before extracting anything, compare `release/air_tests/air_benchmarks/workloads/tensorflow_benchmark.py` and `release/air_tests/air_benchmarks/workloads/torch_benchmark.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 155 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 `release/air_tests/air_benchmarks/workloads/tensorflow_benchmark.py:207` it begins part-way through the construct above it, so those 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, `release/air_tests/air_benchmarks/workloads/torch_benchmark.py:368` calls `str` and `release/air_tests/air_benchmarks/workloads/tensorflow_benchmark.py:206` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 2) release/nightly_tests/dataset/profiling/analysis/analyze_pyspy_profile.py:219— release/nightly_tests/dataset/profiling/analysis/analyze_pyspy_profile.py:219-228 | release/nightly_tests/dataset/profiling/analysis/analyze_pyspy_profile.py:599-608 — both copies are in the same file, so extract the 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) REDACTED:56— REDACTED:56-63 | REDACTED:70-77 — both copies are in the same file, so extract the 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 (8 lines × 2) python/ray/autoscaler/_private/aws/cloudwatch/cloudwatch_helper.py:602— python/ray/autoscaler/_private/aws/cloudwatch/cloudwatch_helper.py:602-609 | python/ray/autoscaler/_private/aws/cloudwatch/cloudwatch_helper.py:674-681 — both copies are in the same file, so extract the 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) python/ray/cloudpickle/__init__.py:27— python/ray/cloudpickle/__init__.py:27-34 | python/ray/cloudpickle/__init__.py:40-47 — both copies are in the same file, so extract the 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) python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_map_operator.py:547— python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_map_operator.py:547-554 | python/ray/data/_internal/execution/operators/shuffle_operators/shuffle_map_operator.py:432-439 — before extracting anything, compare `python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_map_operator.py` and `python/ray/data/_internal/execution/operators/shuffle_operators/shuffle_map_operator.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 102 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (8 lines × 2) python/ray/rllib/algorithms/algorithm_config.py:708— python/ray/rllib/algorithms/algorithm_config.py:708-715 | python/ray/rllib/algorithms/algorithm_config.py:875-882 — both copies are in the same file, so extract the 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) python/ray/rllib/algorithms/cql/cql_tf_policy.py:101— python/ray/rllib/algorithms/cql/cql_tf_policy.py:101-108 | python/ray/rllib/algorithms/cql/cql_torch_policy.py:104-111 — 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) python/ray/rllib/policy/sample_batch.py:1207— python/ray/rllib/policy/sample_batch.py:1207-1214 | python/ray/rllib/policy/sample_batch.py:1222-1229 — both copies are in the same file, so extract the 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) REDACTED:871— REDACTED:871-878 | REDACTED:889-896 — both copies are in the same file, so extract the 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, `REDACTED:900` calls `_is_dir`, `get_file_info`, `as_posix` and `REDACTED:879` 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) python/ray/serve/metrics.py:20— python/ray/serve/metrics.py:20-28 | python/ray/serve/metrics.py:43-50 — both copies are in the same file, so extract the 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 (8 lines × 2) python/ray/train/_internal/state/export.py:55— python/ray/train/_internal/state/export.py:55-62 | python/ray/train/v2/_internal/state/export.py:91-98 — 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 first that the copies are not typed on the same thing: the declarations holding them bind `worker` to `TrainWorkerInfo` in one and `TrainWorker` 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 lines × 2) python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_map_operator.py:414— python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_map_operator.py:414-421 | python/ray/data/_internal/execution/operators/shuffle_operators/shuffle_map_operator.py:373-380 — before extracting anything, compare `python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_map_operator.py` and `python/ray/data/_internal/execution/operators/shuffle_operators/shuffle_map_operator.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 102 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 (8 lines × 2) python/ray/experimental/raysort/main.py:203— python/ray/experimental/raysort/main.py:203-210 | python/ray/experimental/raysort/sortlib.py:13-20 — 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 (8 lines × 2) python/ray/llm/_internal/serve/serving_patterns/data_parallel/builder.py:80— python/ray/llm/_internal/serve/serving_patterns/data_parallel/builder.py:80-87 | python/ray/llm/_internal/serve/serving_patterns/prefill_decode/builder.py:64-71 — 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) python/ray/rllib/algorithms/dqn/dqn.py:519— python/ray/rllib/algorithms/dqn/dqn.py:519-526 | python/ray/rllib/algorithms/sac/sac.py:503-510 — 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) python/ray/rllib/utils/exploration/gaussian_noise.py:115— python/ray/rllib/utils/exploration/gaussian_noise.py:115-122 | python/ray/rllib/utils/exploration/stochastic_sampling.py:81-88 — 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 (8 lines × 2) REDACTED:2183— REDACTED:2183-2191 | REDACTED:1775-1782 — 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 (8 lines × 2) python/ray/train/_internal/storage.py:237— python/ray/train/_internal/storage.py:237-244 | python/ray/train/v2/_internal/execution/storage.py:232-239 — before extracting anything, compare `python/ray/train/_internal/storage.py` and `python/ray/train/v2/_internal/execution/storage.py` as WHOLE FILES: this scan already matched 8 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. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 2) python/ray/_private/accelerators/mblt.py:46— python/ray/_private/accelerators/mblt.py:46-53 | python/ray/_private/accelerators/rbln.py:27-34 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from 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 (8 lines × 2) REDACTED:308— REDACTED:308-315 | REDACTED:285-292 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 70 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 2) REDACTED:694— REDACTED:694-701 | python/ray/data/_internal/logical/interfaces/operator.py:19-26 — 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 (8 lines × 2) python/ray/data/_internal/execution/operators/mix_operator.py:124— python/ray/data/_internal/execution/operators/mix_operator.py:124-134 | python/ray/data/_internal/logical/operators/n_ary_operator.py:163-170 — 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) python/ray/rllib/examples/rl_modules/classes/intrinsic_curiosity_model_rlm.py:104— python/ray/rllib/examples/rl_modules/classes/intrinsic_curiosity_model_rlm.py:104-111 | python/ray/rllib/examples/rl_modules/classes/intrinsic_curiosity_model_rlm.py:137-144 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) release/jobs_tests/workloads/jobs_basic.py:26— release/jobs_tests/workloads/jobs_basic.py:26-33 | release/jobs_tests/workloads/jobs_specify_num_gpus.py:28-35 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Low cohesion: AlgorithmConfig (LCOM4 11) python/ray/rllib/algorithms/algorithm_config.py:109— AlgorithmConfig's methods fall into 11 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 11 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: Worker (LCOM4 9) REDACTED:445— Worker's methods fall into 9 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 9 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: StateDataSourceClient (LCOM4 8) python/ray/util/state/state_manager.py:122— StateDataSourceClient's methods fall into 8 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 8 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: AutoscalingConfig (LCOM4 7) python/ray/autoscaler/v2/instance_manager/config.py:160— AutoscalingConfig'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: LLMRouter (LCOM4 6) release/llm_tests/kv_router_test/utils.py:113— LLMRouter'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: PhysicalOperator (LCOM4 6) REDACTED:585— PhysicalOperator'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: CQLConfig (LCOM4 6) python/ray/rllib/algorithms/cql/cql.py:57— CQLConfig'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: MARWILConfig (LCOM4 6) python/ray/rllib/algorithms/marwil/marwil.py:44— MARWILConfig'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: _TrainSession (LCOM4 6) python/ray/train/_internal/session.py:112— _TrainSession'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: DAGNode (LCOM4 5) python/ray/dag/dag_node.py:33— DAGNode'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: ReporterAgent (LCOM4 5) REDACTED:501— ReporterAgent'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: ParquetFileReader (LCOM4 5) python/ray/data/_internal/datasource_v2/formats/parquet/parquet_file_reader.py:196— ParquetFileReader'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: MapOperator (LCOM4 5) python/ray/data/_internal/execution/operators/map_operator.py:211— MapOperator'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: DreamerV3Config (LCOM4 5) python/ray/rllib/algorithms/dreamerv3/dreamerv3.py:58— DreamerV3Config'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: IMPALAConfig (LCOM4 5) python/ray/rllib/algorithms/impala/impala.py:72— IMPALAConfig'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: StatsBase (LCOM4 5) python/ray/rllib/utils/metrics/stats/base.py:15— StatsBase'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: Dataset (LCOM4 4) REDACTED:272— Dataset'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: LLMConfig (LCOM4 4) python/ray/llm/_internal/serve/core/configs/llm_config.py:152— LLMConfig'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: APPOConfig (LCOM4 4) python/ray/rllib/algorithms/appo/appo.py:44— APPOConfig'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: SACTFModel (LCOM4 4) python/ray/rllib/algorithms/sac/sac_tf_model.py:18— SACTFModel'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: SACTorchModel (LCOM4 4) python/ray/rllib/algorithms/sac/sac_torch_model.py:18— SACTorchModel'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: EagerTFPolicyV2 (LCOM4 4) python/ray/rllib/policy/eager_tf_policy_v2.py:59— EagerTFPolicyV2'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: ClientActorClass (LCOM4 4) REDACTED:344— ClientActorClass'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.
Swallowed exception (caught, then discarded) release/ray_release/command_runner/anyscale_job_runner.py:185— `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) release/ray_release/buildkite/filter.py:17— `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:1164— `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) python/ray/tune/search/ax/ax_search.py:33— `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) python/ray/tune/search/ax/ax_search.py:295— `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:415— `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) python/ray/train/v2/_internal/execution/worker_group/worker_group.py:886— `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) python/ray/train/lint/check_circular_imports.py:240— `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) python/ray/serve/_private/default_impl.py:148— `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:1796— `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:1807— `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:244— `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) python/ray/serve/_private/utils.py:78— `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) python/ray/serve/_private/utils.py:120— `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) python/ray/serve/_private/utils.py:712— `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) python/ray/data/expressions.py:362— `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) python/ray/data/expressions.py:981— `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) python/ray/data/_internal/util.py:1630— `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) python/ray/data/_internal/planner/_obstore_download.py:522— `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) python/ray/data/_internal/planner/download_partition_actor.py:63— `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) python/ray/data/_internal/planner/download_partition_actor.py:148— `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) python/ray/data/_internal/gpu_shuffle/rapidsmpf_backend.py:44— `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:2198— `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 (11 lines × 2) doc/source/tune/doc_code/pytorch_optuna.py:14— doc/source/tune/doc_code/pytorch_optuna.py:14-24 | python/ray/tune/examples/mnist_pytorch.py:39-49 — before extracting anything, compare `doc/source/tune/doc_code/pytorch_optuna.py` and `python/ray/tune/examples/mnist_pytorch.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) python/ray/air/integrations/keras.py:144— python/ray/air/integrations/keras.py:144-154 | python/ray/train/tensorflow/keras.py:112-122 — before extracting anything, compare `python/ray/air/integrations/keras.py` and `python/ray/train/tensorflow/keras.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 (11 lines × 2) python/ray/autoscaler/_private/commands.py:948— python/ray/autoscaler/_private/commands.py:948-958 | python/ray/autoscaler/_private/commands.py:969-980 — both copies are in the same file, so extract the 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 `python/ray/autoscaler/_private/commands.py:969` it begins part-way through the construct above it, so those 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 × 2) REDACTED:584— REDACTED:584-595 | REDACTED:2033-2043 — both copies are in the same file, so extract the 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:584` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (11 lines × 2) python/ray/experimental/channel/common.py:375— python/ray/experimental/channel/common.py:375-387 | python/ray/experimental/channel/common.py:463-473 — both copies are in the same file, so extract the 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) python/ray/rllib/algorithms/appo/appo_torch_policy.py:165— python/ray/rllib/algorithms/appo/appo_torch_policy.py:165-175 | python/ray/rllib/algorithms/impala/impala_torch_policy.py:331-341 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (11 lines × 2) python/ray/rllib/core/models/configs.py:224— python/ray/rllib/core/models/configs.py:224-234 | python/ray/rllib/core/models/configs.py:1169-1179 — both copies are in the same file, so extract the 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 `python/ray/rllib/core/models/configs.py:224` it begins part-way through the construct above it, so those 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, `python/ray/rllib/core/models/configs.py:223` calls `ValueError` and `python/ray/rllib/core/models/configs.py:1168` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11 lines × 2) python/ray/rllib/models/tf/tf_action_dist.py:195— python/ray/rllib/models/tf/tf_action_dist.py:195-205 | python/ray/rllib/models/torch/torch_action_dist.py:180-190 — `python/ray/rllib/models/tf/tf_action_dist.py` and `python/ray/rllib/models/torch/torch_action_dist.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 5 separate duplicated blocks between them, totalling at least 42 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 (11 lines × 2) python/ray/rllib/models/tf/tf_action_dist.py:226— python/ray/rllib/models/tf/tf_action_dist.py:226-236 | python/ray/rllib/models/torch/torch_action_dist.py:211-221 — `python/ray/rllib/models/tf/tf_action_dist.py` and `python/ray/rllib/models/torch/torch_action_dist.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 5 separate duplicated blocks between them, totalling at least 42 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (11 lines × 2) python/ray/rllib/models/tf/visionnet.py:113— python/ray/rllib/models/tf/visionnet.py:113-123 | python/ray/rllib/models/tf/visionnet.py:221-231 — both copies are in the same file, so extract the 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) python/ray/rllib/policy/dynamic_tf_policy.py:1063— python/ray/rllib/policy/dynamic_tf_policy.py:1063-1073 | python/ray/rllib/policy/dynamic_tf_policy.py:1091-1101 — both copies are in the same file, so extract the 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:362— REDACTED:362-372 | python/ray/autoscaler/_private/loader.py:5-15 — 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 (11 lines × 2) python/ray/air/integrations/keras.py:32— python/ray/air/integrations/keras.py:32-42 | python/ray/train/tensorflow/keras.py:33-43 — before extracting anything, compare `python/ray/air/integrations/keras.py` and `python/ray/train/tensorflow/keras.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 (11 lines × 2) python/ray/air/util/data_batch_conversion.py:272— python/ray/air/util/data_batch_conversion.py:272-282 | python/ray/data/util/data_batch_conversion.py:232-242 — before extracting anything, compare `python/ray/air/util/data_batch_conversion.py` and `python/ray/data/util/data_batch_conversion.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 113 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 (11 lines × 2) python/ray/dashboard/modules/job/job_head.py:349— python/ray/dashboard/modules/job/job_head.py:349-359 | python/ray/dashboard/modules/serve/serve_head.py:73-83 — 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 (11 lines × 2) python/ray/data/_internal/iterator/push_split_coordinator.py:270— python/ray/data/_internal/iterator/push_split_coordinator.py:270-280 | python/ray/data/_internal/iterator/stream_split_iterator.py:267-277 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from 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) python/ray/rllib/offline/offline_evaluation_runner.py:366— python/ray/rllib/offline/offline_evaluation_runner.py:366-376 | python/ray/rllib/offline/offline_policy_evaluation_runner.py:581-591 — before extracting anything, compare `python/ray/rllib/offline/offline_evaluation_runner.py` and `python/ray/rllib/offline/offline_policy_evaluation_runner.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 119 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) python/ray/rllib/connectors/action/clip.py:21— python/ray/rllib/connectors/action/clip.py:21-31 | python/ray/rllib/connectors/action/normalize.py:24-34 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from 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) python/ray/train/lightgbm/v2.py:121— python/ray/train/lightgbm/v2.py:121-131 | python/ray/train/xgboost/v2.py:117-127 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (11 lines × 2) python/ray/rllib/examples/rl_modules/classes/vpg_using_shared_encoder_rlm.py:33— python/ray/rllib/examples/rl_modules/classes/vpg_using_shared_encoder_rlm.py:33-43 | python/ray/rllib/examples/rl_modules/classes/vpg_using_shared_encoder_rlm.py:233-243 — both copies are in the same file, so extract the 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) python/ray/_private/authentication/grpc_authentication_client_interceptor.py:48— python/ray/_private/authentication/grpc_authentication_client_interceptor.py:48-59 | python/ray/_private/authentication/grpc_authentication_client_interceptor.py:83-94 — both copies are in the same file, so extract the 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) python/ray/_private/runtime_env/nsight.py:85— python/ray/_private/runtime_env/nsight.py:85-96 | python/ray/_private/runtime_env/rocprof_sys.py:106-117 — 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) python/ray/dag/format_utils.py:40— python/ray/dag/format_utils.py:40-51 | python/ray/dag/format_utils.py:85-96 — both copies are in the same file, so extract the 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 `python/ray/dag/format_utils.py:40` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) REDACTED:1129— REDACTED:1129-1140 | REDACTED:1144-1155 — both copies are in the same file, so extract the 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) python/ray/data/_internal/tensor_extensions/pandas.py:89— python/ray/data/_internal/tensor_extensions/pandas.py:89-100 | python/ray/data/_internal/tensor_extensions/pandas.py:133-144 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `python/ray/data/_internal/tensor_extensions/pandas.py:89` it begins part-way through the construct above it, so those 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) python/ray/rllib/algorithms/dqn/dqn_tf_policy.py:194— python/ray/rllib/algorithms/dqn/dqn_tf_policy.py:194-205 | python/ray/rllib/algorithms/dqn/dqn_tf_policy.py:215-226 — both copies are in the same file, so extract the 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 `python/ray/rllib/algorithms/dqn/dqn_tf_policy.py:194` it begins part-way through the construct above it, so those 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) python/ray/rllib/models/tf/attention_net.py:346— python/ray/rllib/models/tf/attention_net.py:346-357 | python/ray/rllib/models/torch/attention_net.py:197-208 — `python/ray/rllib/models/tf/attention_net.py` and `python/ray/rllib/models/torch/attention_net.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 5 separate duplicated blocks between them, totalling at least 114 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (12 lines × 2) python/ray/rllib/policy/torch_policy.py:734— python/ray/rllib/policy/torch_policy.py:734-745 | python/ray/rllib/policy/torch_policy_v2.py:925-936 — before extracting anything, compare `python/ray/rllib/policy/torch_policy.py` and `python/ray/rllib/policy/torch_policy_v2.py` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 513 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 (12 lines × 2) python/ray/serve/_private/broker.py:157— python/ray/serve/_private/broker.py:157-168 | python/ray/serve/_private/broker.py:195-206 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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 lines × 2) python/ray/train/_internal/storage.py:93— python/ray/train/_internal/storage.py:93-104 | python/ray/train/v2/_internal/execution/storage.py:87-98 — before extracting anything, compare `python/ray/train/_internal/storage.py` and `python/ray/train/v2/_internal/execution/storage.py` as WHOLE FILES: this scan already matched 8 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. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (12 lines × 2) python/ray/train/v2/_internal/callbacks/env_callback.py:17— python/ray/train/v2/_internal/callbacks/env_callback.py:17-28 | python/ray/tune/utils/callback.py:150-161 — 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) python/ray/train/v2/_internal/execution/worker_group/worker_group.py:425— python/ray/train/v2/_internal/execution/worker_group/worker_group.py:425-436 | python/ray/train/v2/_internal/execution/worker_group/worker_group.py:471-482 — both copies are in the same file, so extract the 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) python/ray/util/collective/collective_group/nccl_collective_group.py:298— python/ray/util/collective/collective_group/nccl_collective_group.py:298-310 | python/ray/util/collective/collective_group/nccl_collective_group.py:340-351 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `python/ray/util/collective/collective_group/nccl_collective_group.py:298` it begins part-way through the construct above it, so those 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, `python/ray/util/collective/collective_group/nccl_collective_group.py:339` calls `get_nccl_reduce_op` and `python/ray/util/collective/collective_group/nccl_collective_group.py:297` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (12 lines × 2) python/ray/util/state/common.py:1083— python/ray/util/state/common.py:1083-1094 | python/ray/util/state/common.py:1278-1289 — both copies are in the same file, so extract the 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) doc/source/llm/doc_code/serve/multi_gpu/dp_autoscaling_example.py:21— doc/source/llm/doc_code/serve/multi_gpu/dp_autoscaling_example.py:21-32 | doc/source/llm/doc_code/serve/multi_gpu/dp_basic_example.py:21-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.
Duplicated block (12 lines × 2) python/ray/dag/class_node.py:62— python/ray/dag/class_node.py:62-73 | python/ray/dag/function_node.py:45-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 (12 lines × 2) python/ray/serve/_private/direct_ingress_http_util.py:91— python/ray/serve/_private/direct_ingress_http_util.py:91-102 | REDACTED:424-435 — 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) release/train_tests/elastic_training/torch_elastic_e2e.py:265— release/train_tests/elastic_training/torch_elastic_e2e.py:265-276 | release/train_tests/elastic_training/torch_elastic_e2e.py:278-289 — both copies are in the same file, so extract the 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) python/ray/train/examples/pytorch/torch_data_prefetch_benchmark/auto_pipeline_for_host_to_device_data_transfer.py:45— python/ray/train/examples/pytorch/torch_data_prefetch_benchmark/auto_pipeline_for_host_to_device_data_transfer.py:45-56 | python/ray/train/examples/pytorch/torch_linear_example.py:30-41 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (7 lines × 2) python/ray/_private/label_utils.py:45— python/ray/_private/label_utils.py:45-51 | python/ray/_private/label_utils.py:93-101 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (7 lines × 2) python/ray/experimental/channel/common.py:389— python/ray/experimental/channel/common.py:389-402 | python/ray/experimental/channel/common.py:475-481 — both copies are in the same file, so extract the 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 (7 lines × 2) python/ray/rllib/algorithms/cql/cql_tf_policy.py:119— python/ray/rllib/algorithms/cql/cql_tf_policy.py:119-125 | python/ray/rllib/algorithms/cql/cql_torch_policy.py:122-128 — 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 `python/ray/rllib/algorithms/cql/cql_tf_policy.py:119` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) python/ray/rllib/core/testing/testing_learner.py:61— python/ray/rllib/core/testing/testing_learner.py:61-67 | python/ray/rllib/examples/learners/classes/vpg_torch_learner.py:65-71 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (7 lines × 2) python/ray/rllib/policy/dynamic_tf_policy.py:1050— python/ray/rllib/policy/dynamic_tf_policy.py:1050-1056 | python/ray/rllib/policy/dynamic_tf_policy.py:1079-1085 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) python/ray/serve/schema.py:1159— python/ray/serve/schema.py:1159-1165 | python/ray/serve/schema.py:1174-1180 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `python/ray/serve/schema.py:1159` 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) REDACTED:221— REDACTED:221-227 | REDACTED:183-189 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (7 lines × 2) doc/source/serve/tutorials/video-analysis/ci/nb2py.py:30— doc/source/serve/tutorials/video-analysis/ci/nb2py.py:30-36 | doc/source/train/examples/transformers/transformer-reinforcement-learning/ci/nb2py.py:62-68 — before extracting anything, compare `doc/source/serve/tutorials/video-analysis/ci/nb2py.py` and `doc/source/train/examples/transformers/transformer-reinforcement-learning/ci/nb2py.py` as WHOLE FILES: 93% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (7 lines × 2) python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_reduce_operator.py:388— python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_reduce_operator.py:388-394 | python/ray/data/_internal/execution/operators/shuffle_operators/shuffle_reduce_operator.py:451-457 — before extracting anything, compare `python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_reduce_operator.py` and `python/ray/data/_internal/execution/operators/shuffle_operators/shuffle_reduce_operator.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 144 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) python/ray/rllib/models/tf/tf_action_dist.py:665— python/ray/rllib/models/tf/tf_action_dist.py:665-671 | python/ray/rllib/models/torch/torch_action_dist.py:571-577 — `python/ray/rllib/models/tf/tf_action_dist.py` and `python/ray/rllib/models/torch/torch_action_dist.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 5 separate duplicated blocks between them, totalling at least 42 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) python/ray/rllib/utils/metrics/legacy_stats.py:309— python/ray/rllib/utils/metrics/legacy_stats.py:309-315 | python/ray/rllib/utils/metrics/stats/base.py:140-149 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (7 lines × 2) python/ray/rllib/models/tf/tf_action_dist.py:103— python/ray/rllib/models/tf/tf_action_dist.py:103-109 | python/ray/rllib/models/torch/torch_action_dist.py:91-97 — `python/ray/rllib/models/tf/tf_action_dist.py` and `python/ray/rllib/models/torch/torch_action_dist.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 5 separate duplicated blocks between them, totalling at least 42 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) python/ray/rllib/offline/offline_evaluation_runner.py:101— python/ray/rllib/offline/offline_evaluation_runner.py:101-107 | python/ray/rllib/offline/offline_policy_evaluation_runner.py:303-309 — before extracting anything, compare `python/ray/rllib/offline/offline_evaluation_runner.py` and `python/ray/rllib/offline/offline_policy_evaluation_runner.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 119 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) python/ray/rllib/utils/metrics/stats/max.py:20— python/ray/rllib/utils/metrics/stats/max.py:20-26 | python/ray/rllib/utils/metrics/stats/min.py:20-26 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. 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) release/nightly_tests/dataset/profiling/analysis/analyze_pyspy_profile.py:553— release/nightly_tests/dataset/profiling/analysis/analyze_pyspy_profile.py:553-560 | release/nightly_tests/dataset/profiling/analysis/analyze_pyspy_profile.py:719-725 — both copies are in the same file, so extract the 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 `release/nightly_tests/dataset/profiling/analysis/analyze_pyspy_profile.py:553` it begins part-way through the construct above it, so those 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) release/serve_tests/workloads/plot_router_benchmark.py:135— release/serve_tests/workloads/plot_router_benchmark.py:135-141 | release/serve_tests/workloads/plot_router_benchmark.py:269-275 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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) python/ray/tune/examples/xgboost_dynamic_resources_example.py:22— python/ray/tune/examples/xgboost_dynamic_resources_example.py:22-29 | python/ray/tune/examples/xgboost_example.py:70-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. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (7 lines × 2) release/nightly_tests/dataset/benchmark.py:122— release/nightly_tests/dataset/benchmark.py:122-128 | release/nightly_tests/multimodal_inference_benchmarks/benchmark.py:122-128 — `release/nightly_tests/dataset/benchmark.py` and `release/nightly_tests/multimodal_inference_benchmarks/benchmark.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 9 separate duplicated blocks between them, totalling at least 302 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) release/nightly_tests/dataset/benchmark.py:146— release/nightly_tests/dataset/benchmark.py:146-152 | release/nightly_tests/multimodal_inference_benchmarks/benchmark.py:146-152 — `release/nightly_tests/dataset/benchmark.py` and `release/nightly_tests/multimodal_inference_benchmarks/benchmark.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 9 separate duplicated blocks between them, totalling at least 302 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 (19 lines × 2) doc/source/serve/tutorials/video-analysis/utils/video.py:327— doc/source/serve/tutorials/video-analysis/utils/video.py:327-345 | doc/source/serve/tutorials/video-analysis/utils/video.py:416-434 — both copies are in the same file, so extract the 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 lines × 2) python/ray/_private/runtime_env/py_modules.py:192— python/ray/_private/runtime_env/py_modules.py:192-210 | python/ray/_private/runtime_env/working_dir.py:217-235 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (19 lines × 2) python/ray/dashboard/state_aggregator.py:649— python/ray/dashboard/state_aggregator.py:649-667 | python/ray/dashboard/state_aggregator.py:672-690 — both copies are in the same file, so extract the 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 `python/ray/dashboard/state_aggregator.py:649` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (19 lines × 2) REDACTED:1445— REDACTED:1445-1463 | REDACTED:1746-1764 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19 lines × 2) python/ray/rllib/algorithms/sac/sac_tf_policy.py:159— python/ray/rllib/algorithms/sac/sac_tf_policy.py:159-177 | python/ray/rllib/algorithms/sac/sac_torch_policy.py:56-74 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: `ModelCatalog` names `ray.rllib.models` in one and `ray.rllib.models.catalog` 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) python/ray/rllib/offline/offline_policy_evaluation_runner.py:167— python/ray/rllib/offline/offline_policy_evaluation_runner.py:167-185 | python/ray/rllib/offline/offline_policy_evaluation_runner.py:197-215 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `python/ray/rllib/offline/offline_policy_evaluation_runner.py:167` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19 lines × 2) python/ray/rllib/utils/exploration/gaussian_noise.py:152— python/ray/rllib/utils/exploration/gaussian_noise.py:152-170 | python/ray/rllib/utils/exploration/ornstein_uhlenbeck_noise.py:144-162 — before extracting anything, compare `python/ray/rllib/utils/exploration/gaussian_noise.py` and `python/ray/rllib/utils/exploration/ornstein_uhlenbeck_noise.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 58 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `python/ray/rllib/utils/exploration/gaussian_noise.py:152` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19 lines × 2) python/ray/serve/_private/config.py:1119— python/ray/serve/_private/config.py:1119-1137 | python/ray/serve/_private/version.py:160-178 — 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 `python/ray/serve/_private/config.py:1119` 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 (19 lines × 2) REDACTED:641— REDACTED:641-659 | REDACTED:708-726 — both copies are in the same file, so extract the 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:641` it begins part-way through the construct above it, so those 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, `REDACTED:707` calls `async_request_iterator` and `REDACTED:640` 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 (19 lines × 2) python/ray/train/lightgbm/lightgbm_trainer.py:269— python/ray/train/lightgbm/lightgbm_trainer.py:269-287 | python/ray/train/xgboost/xgboost_trainer.py:255-273 — 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 (19 lines × 2) python/ray/tune/search/sample.py:278— python/ray/tune/search/sample.py:278-296 | python/ray/tune/search/sample.py:387-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. 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 lines × 2) REDACTED:387— REDACTED:387-405 | REDACTED:441-459 — both copies are in the same file, so extract the 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 lines × 2) python/ray/llm/_internal/batch/observability/logging/setup.py:8— python/ray/llm/_internal/batch/observability/logging/setup.py:8-26 | python/ray/llm/_internal/common/observability/logging/setup.py:8-26 — before extracting anything, compare `python/ray/llm/_internal/batch/observability/logging/setup.py` and `python/ray/llm/_internal/common/observability/logging/setup.py` as WHOLE FILES: 84% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 `python/ray/llm/_internal/batch/observability/logging/setup.py:8` it begins part-way through the construct above it, so those 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: `CoreContextFilter` names `ray._common.filters` in one and `ray._private.ray_logging.filters` 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) python/ray/rllib/examples/multi_agent/utils/self_play_league_based_callback.py:128— python/ray/rllib/examples/multi_agent/utils/self_play_league_based_callback.py:128-146 | python/ray/rllib/examples/multi_agent/utils/self_play_league_based_callback_old_api_stack.py:84-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 both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `python/ray/rllib/examples/multi_agent/utils/self_play_league_based_callback.py:128` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19 lines × 2) python/ray/train/examples/horovod/horovod_example.py:44— python/ray/train/examples/horovod/horovod_example.py:44-62 | python/ray/train/examples/horovod/horovod_pytorch_example.py:45-63 — before extracting anything, compare `python/ray/train/examples/horovod/horovod_example.py` and `python/ray/train/examples/horovod/horovod_pytorch_example.py` as WHOLE FILES: this scan already matched 5 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.
Duplicated block (19 lines × 2) release/nightly_tests/dataset/multi_node_train_benchmark.py:134— release/nightly_tests/dataset/multi_node_train_benchmark.py:134-152 | release/nightly_tests/dataset/multi_node_train_benchmark.py:172-190 — both copies are in the same file, so extract the 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 `release/nightly_tests/dataset/multi_node_train_benchmark.py:134` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19 lines × 2) release/nightly_tests/dataset/profiling/perf.py:88— release/nightly_tests/dataset/profiling/perf.py:88-106 | REDACTED:235-255 — 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 (19 lines × 2) REDACTED:72— REDACTED:72-91 | REDACTED:239-257 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) ci/ray_ci/automation/crane_lib.py:185— ci/ray_ci/automation/crane_lib.py:185-197 | ci/ray_ci/automation/crane_lib.py:283-295 — both copies are in the same file, so extract the 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) python/ray/_private/runtime_env/agent/runtime_env_agent.py:620— python/ray/_private/runtime_env/agent/runtime_env_agent.py:620-632 | python/ray/_private/runtime_env/agent/runtime_env_agent.py:733-745 — both copies are in the same file, so extract the 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) python/ray/autoscaler/_private/aws/config.py:933— python/ray/autoscaler/_private/aws/config.py:933-945 | python/ray/autoscaler/_private/aws/config.py:951-963 — both copies are in the same file, so extract the 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) REDACTED:1662— REDACTED:1662-1674 | REDACTED:1679-1691 — both copies are in the same file, so extract the 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) python/ray/dashboard/modules/reporter/reporter_head.py:390— python/ray/dashboard/modules/reporter/reporter_head.py:390-402 | python/ray/dashboard/modules/reporter/reporter_head.py:607-619 — both copies are in the same file, so extract the 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) python/ray/data/_internal/execution/operators/hash_aggregate.py:155— python/ray/data/_internal/execution/operators/hash_aggregate.py:155-167 | python/ray/data/_internal/execution/operators/join.py:740-752 — 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 `python/ray/data/_internal/execution/operators/hash_aggregate.py:155` it begins part-way through the construct above it, so those 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) python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_map_operator.py:75— python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_map_operator.py:75-87 | python/ray/data/_internal/execution/operators/shuffle_operators/shuffle_map_operator.py:97-109 — before extracting anything, compare `python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_map_operator.py` and `python/ray/data/_internal/execution/operators/shuffle_operators/shuffle_map_operator.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 102 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (13 lines × 2) python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_map_operator.py:191— python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_map_operator.py:191-203 | python/ray/data/_internal/execution/operators/shuffle_operators/shuffle_map_operator.py:187-199 — before extracting anything, compare `python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_map_operator.py` and `python/ray/data/_internal/execution/operators/shuffle_operators/shuffle_map_operator.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 102 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13 lines × 2) REDACTED:3474— REDACTED:3474-3486 | REDACTED:3554-3566 — both copies are in the same file, so extract the 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:3474` it begins part-way through the construct above it, so those 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) python/ray/rllib/algorithms/appo/appo_tf_policy.py:122— python/ray/rllib/algorithms/appo/appo_tf_policy.py:122-134 | python/ray/rllib/algorithms/impala/impala_tf_policy.py:335-347 — 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 (13 lines × 2) python/ray/rllib/algorithms/sac/sac_tf_policy.py:84— python/ray/rllib/algorithms/sac/sac_tf_policy.py:84-96 | python/ray/rllib/algorithms/sac/sac_tf_policy.py:105-117 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `python/ray/rllib/algorithms/sac/sac_tf_policy.py:84` it begins part-way through the construct above it, so those 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) python/ray/rllib/core/models/configs.py:1000— python/ray/rllib/core/models/configs.py:1000-1012 | python/ray/rllib/core/models/configs.py:1156-1171 — both copies are in the same file, so extract the 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 `python/ray/rllib/core/models/configs.py:1000` it begins part-way through the construct above it, so those 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) python/ray/rllib/core/models/torch/encoder.py:173— python/ray/rllib/core/models/torch/encoder.py:173-185 | python/ray/rllib/core/models/torch/encoder.py:263-275 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) python/ray/rllib/policy/torch_policy.py:263— python/ray/rllib/policy/torch_policy.py:263-275 | python/ray/rllib/policy/torch_policy_v2.py:186-198 — before extracting anything, compare `python/ray/rllib/policy/torch_policy.py` and `python/ray/rllib/policy/torch_policy_v2.py` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 513 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (13 lines × 2) python/ray/train/_internal/storage.py:78— python/ray/train/_internal/storage.py:78-90 | python/ray/train/v2/_internal/execution/storage.py:72-84 — before extracting anything, compare `python/ray/train/_internal/storage.py` and `python/ray/train/v2/_internal/execution/storage.py` as WHOLE FILES: this scan already matched 8 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. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (13 lines × 2) python/ray/tune/experimental/output.py:236— python/ray/tune/experimental/output.py:236-248 | python/ray/tune/progress_reporter.py:421-433 — 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 lines × 2) python/ray/rllib/core/learner/torch/torch_differentiable_learner.py:276— python/ray/rllib/core/learner/torch/torch_differentiable_learner.py:276-289 | python/ray/rllib/core/learner/torch/torch_meta_learner.py:454-466 — 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) python/ray/tune/examples/bayesopt_example.py:16— python/ray/tune/examples/bayesopt_example.py:16-28 | python/ray/tune/examples/nevergrad_example.py:17-29 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (16 lines × 2) .buildkite/copy_files.py:13— .buildkite/copy_files.py:13-28 | release/ray_release/aws.py:122-137 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (16 lines × 2) python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_reduce_operator.py:182— python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_reduce_operator.py:182-197 | python/ray/data/_internal/execution/operators/shuffle_operators/shuffle_reduce_operator.py:223-238 — before extracting anything, compare `python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_reduce_operator.py` and `python/ray/data/_internal/execution/operators/shuffle_operators/shuffle_reduce_operator.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 144 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 `python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_reduce_operator.py:182` it begins part-way through the construct above it, so those 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) python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_reduce_operator.py:254— python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_reduce_operator.py:254-269 | python/ray/data/_internal/execution/operators/shuffle_operators/shuffle_reduce_operator.py:301-316 — before extracting anything, compare `python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_reduce_operator.py` and `python/ray/data/_internal/execution/operators/shuffle_operators/shuffle_reduce_operator.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 144 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 `python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_reduce_operator.py:254` it begins part-way through the construct above it, so those 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 `bundles` to `List[Optional[RefBundle]]` in one and `List[RefBundle]` 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) python/ray/experimental/channel/common.py:611— python/ray/experimental/channel/common.py:611-626 | python/ray/experimental/channel/common.py:652-667 — both copies are in the same file, so extract the 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) python/ray/rllib/algorithms/cql/cql_tf_policy.py:196— python/ray/rllib/algorithms/cql/cql_tf_policy.py:196-211 | python/ray/rllib/algorithms/cql/cql_torch_policy.py:207-222 — 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 `python/ray/rllib/algorithms/cql/cql_tf_policy.py:196` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 2) python/ray/rllib/algorithms/cql/torch/cql_torch_learner.py:159— python/ray/rllib/algorithms/cql/torch/cql_torch_learner.py:159-174 | python/ray/rllib/algorithms/cql/torch/cql_torch_learner.py:178-195 — both copies are in the same file, so extract the 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) python/ray/rllib/algorithms/impala/torch/impala_torch_learner.py:318— python/ray/rllib/algorithms/impala/torch/impala_torch_learner.py:318-333 | python/ray/rllib/core/learner/torch/torch_learner.py:173-188 — 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 (16 lines × 2) python/ray/rllib/core/learner/differentiable_learner.py:467— python/ray/rllib/core/learner/differentiable_learner.py:467-482 | python/ray/rllib/core/learner/learner.py:1295-1310 — before extracting anything, compare `python/ray/rllib/core/learner/differentiable_learner.py` and `python/ray/rllib/core/learner/learner.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 141 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 `python/ray/rllib/core/learner/differentiable_learner.py:467` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 2) python/ray/rllib/core/learner/torch/torch_differentiable_learner.py:333— python/ray/rllib/core/learner/torch/torch_differentiable_learner.py:333-348 | python/ray/rllib/core/learner/torch/torch_learner.py:664-679 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (16 lines × 2) python/ray/rllib/models/tf/complex_input_net.py:62— python/ray/rllib/models/tf/complex_input_net.py:62-77 | python/ray/rllib/models/torch/complex_input_net.py:70-86 — `python/ray/rllib/models/tf/complex_input_net.py` and `python/ray/rllib/models/torch/complex_input_net.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 4 separate duplicated blocks between them, totalling at least 72 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `python/ray/rllib/models/torch/complex_input_net.py:68` calls `str` and `python/ray/rllib/models/tf/complex_input_net.py:60` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (16 lines × 2) python/ray/rllib/models/tf/complex_input_net.py:100— python/ray/rllib/models/tf/complex_input_net.py:100-115 | python/ray/rllib/models/torch/complex_input_net.py:120-135 — `python/ray/rllib/models/tf/complex_input_net.py` and `python/ray/rllib/models/torch/complex_input_net.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 4 separate duplicated blocks between them, totalling at least 72 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 `python/ray/rllib/models/tf/complex_input_net.py:100` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 2) python/ray/rllib/offline/offline_evaluation_runner.py:297— python/ray/rllib/offline/offline_evaluation_runner.py:297-312 | python/ray/rllib/offline/offline_policy_evaluation_runner.py:469-484 — before extracting anything, compare `python/ray/rllib/offline/offline_evaluation_runner.py` and `python/ray/rllib/offline/offline_policy_evaluation_runner.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 119 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, `python/ray/rllib/offline/offline_policy_evaluation_runner.py:466` calls `set_state` and `python/ray/rllib/offline/offline_evaluation_runner.py:294` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (16 lines × 2) python/ray/train/_internal/worker_group.py:421— python/ray/train/_internal/worker_group.py:421-436 | python/ray/train/v2/_internal/execution/worker_group/worker_group.py:1240-1255 — 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 (16 lines × 2) python/ray/rllib/algorithms/cql/cql.py:170— python/ray/rllib/algorithms/cql/cql.py:170-185 | python/ray/rllib/algorithms/marwil/marwil.py:324-339 — 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 (16 lines × 2) python/ray/rllib/algorithms/appo/appo.py:334— python/ray/rllib/algorithms/appo/appo.py:334-349 | python/ray/rllib/algorithms/ppo/ppo.py:173-188 — 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 (16 lines × 2) java/api/src/main/java/io/ray/api/call/CppActorTaskCaller.java:18— java/api/src/main/java/io/ray/api/call/CppActorTaskCaller.java:18-33 | java/api/src/main/java/io/ray/api/call/PyActorTaskCaller.java:18-33 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. 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 `actor` to `CppActorHandle` in one and `PyActorHandle` 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) release/nightly_tests/dataset/benchmark.py:165— release/nightly_tests/dataset/benchmark.py:165-180 | release/nightly_tests/multimodal_inference_benchmarks/benchmark.py:165-180 — `release/nightly_tests/dataset/benchmark.py` and `release/nightly_tests/multimodal_inference_benchmarks/benchmark.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 9 separate duplicated blocks between them, totalling at least 302 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 (14 lines × 2) doc/source/train/doc_code/tf_starter.py:54— doc/source/train/doc_code/tf_starter.py:54-67 | python/ray/train/examples/tf/tensorflow_regression_example.py:46-59 — 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 `doc/source/train/doc_code/tf_starter.py:54` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (14 lines × 2) python/ray/_private/ray_experimental_perf.py:203— python/ray/_private/ray_experimental_perf.py:203-216 | python/ray/_private/ray_experimental_perf.py:232-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 (14 lines × 2) python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_reduce_operator.py:145— python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_reduce_operator.py:145-158 | python/ray/data/_internal/execution/operators/shuffle_operators/shuffle_reduce_operator.py:174-187 — before extracting anything, compare `python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_reduce_operator.py` and `python/ray/data/_internal/execution/operators/shuffle_operators/shuffle_reduce_operator.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_reduce_operator.py:159` calls `merge_label_selector` and `python/ray/data/_internal/execution/operators/shuffle_operators/shuffle_reduce_operator.py:188` 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 (14 lines × 2) python/ray/data/read_api.py:2025— python/ray/data/read_api.py:2025-2038 | python/ray/data/read_api.py:3089-3102 — both copies are in the same file, so extract the 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) python/ray/rllib/algorithms/appo/appo_tf_policy.py:136— python/ray/rllib/algorithms/appo/appo_tf_policy.py:136-149 | python/ray/rllib/algorithms/impala/impala_tf_policy.py:349-362 — 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) python/ray/rllib/algorithms/appo/torch/appo_torch_learner.py:244— python/ray/rllib/algorithms/appo/torch/appo_torch_learner.py:244-257 | python/ray/rllib/algorithms/ppo/torch/ppo_torch_learner.py:158-173 — 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 `python/ray/rllib/algorithms/ppo/torch/ppo_torch_learner.py:158` it begins part-way through the construct above it, so those 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) python/ray/rllib/policy/torch_policy.py:425— python/ray/rllib/policy/torch_policy.py:425-438 | python/ray/rllib/policy/torch_policy_v2.py:598-611 — before extracting anything, compare `python/ray/rllib/policy/torch_policy.py` and `python/ray/rllib/policy/torch_policy_v2.py` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 513 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 `python/ray/rllib/policy/torch_policy.py:425` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (14 lines × 2) python/ray/rllib/policy/torch_policy.py:666— python/ray/rllib/policy/torch_policy.py:666-679 | python/ray/rllib/policy/torch_policy_v2.py:849-862 — before extracting anything, compare `python/ray/rllib/policy/torch_policy.py` and `python/ray/rllib/policy/torch_policy_v2.py` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 513 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 (14 lines × 2) python/ray/tune/search/ax/ax_search.py:326— python/ray/tune/search/ax/ax_search.py:326-339 | REDACTED:286-299 — 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 `python/ray/tune/search/ax/ax_search.py:326` it begins part-way through the construct above it, so those 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) python/ray/experimental/channel/cpu_communicator.py:172— python/ray/experimental/channel/cpu_communicator.py:172-185 | python/ray/experimental/channel/nccl_group.py:124-137 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. 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) python/ray/rllib/algorithms/cql/cql.py:206— python/ray/rllib/algorithms/cql/cql.py:206-219 | python/ray/rllib/algorithms/sac/sac.py:543-556 — 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 first that the copies are not typed on the same thing: `Learner` names `ray.rllib.core.learner` in one and `ray.rllib.core.learner.learner` 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 (14 lines × 2) python/ray/rllib/policy/dynamic_tf_policy_v2.py:379— python/ray/rllib/policy/dynamic_tf_policy_v2.py:379-392 | python/ray/rllib/policy/eager_tf_policy_v2.py:378-391 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14 lines × 2) python/ray/rllib/policy/torch_policy.py:836— python/ray/rllib/policy/torch_policy.py:836-849 | python/ray/rllib/policy/torch_policy_v2.py:418-431 — before extracting anything, compare `python/ray/rllib/policy/torch_policy.py` and `python/ray/rllib/policy/torch_policy_v2.py` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 513 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (14 lines × 2) python/ray/rllib/utils/metrics/stats/lifetime_sum.py:59— python/ray/rllib/utils/metrics/stats/lifetime_sum.py:59-72 | python/ray/rllib/utils/metrics/stats/percentiles.py:247-262 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14 lines × 2) python/ray/train/_internal/storage.py:512— python/ray/train/_internal/storage.py:512-525 | python/ray/train/v2/_internal/execution/storage.py:443-456 — before extracting anything, compare `python/ray/train/_internal/storage.py` and `python/ray/train/v2/_internal/execution/storage.py` as WHOLE FILES: this scan already matched 8 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. 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 (14 lines × 2) python/ray/train/tensorflow/tensorflow_trainer.py:178— python/ray/train/tensorflow/tensorflow_trainer.py:178-191 | python/ray/train/torch/torch_trainer.py:187-200 — 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) REDACTED:278— REDACTED:278-291 | java/runtime/src/main/java/io/ray/runtime/task/NativeTaskSubmitter.java:45-58 — 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:278` 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) doc/source/_ext/llms_txt.py:565— doc/source/_ext/llms_txt.py:565-570 | doc/source/_ext/llms_txt.py:575-580 — both copies are in the same file, so extract the 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) python/ray/_private/ray_perf.py:227— python/ray/_private/ray_perf.py:227-232 | python/ray/_private/ray_perf.py:283-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.
Duplicated block (6 lines × 2) python/ray/data/_internal/logical/operators/read_operator.py:66— python/ray/data/_internal/logical/operators/read_operator.py:66-71 | python/ray/data/_internal/logical/operators/read_operator.py:288-293 — both copies are in the same file, so extract the 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) python/ray/data/expressions.py:1463— python/ray/data/expressions.py:1463-1468 | python/ray/data/expressions.py:1495-1500 — both copies are in the same file, so extract the 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 `python/ray/data/expressions.py:1463` it begins part-way through the construct above it, so those 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) python/ray/rllib/algorithms/cql/cql_tf_policy.py:111— python/ray/rllib/algorithms/cql/cql_tf_policy.py:111-116 | python/ray/rllib/algorithms/cql/cql_torch_policy.py:114-119 — 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) python/ray/rllib/models/tf/layers/multi_head_attention.py:39— python/ray/rllib/models/tf/layers/multi_head_attention.py:39-44 | python/ray/rllib/models/tf/layers/relative_multi_head_attention.py:90-97 — 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) python/ray/rllib/models/tf/layers/multi_head_attention.py:53— python/ray/rllib/models/tf/layers/multi_head_attention.py:53-58 | python/ray/rllib/models/tf/layers/relative_multi_head_attention.py:116-121 — 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) python/ray/rllib/models/torch/modules/multi_head_attention.py:45— python/ray/rllib/models/torch/modules/multi_head_attention.py:45-50 | python/ray/rllib/models/torch/modules/relative_multi_head_attention.py:126-132 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (6 lines × 2) python/ray/tune/schedulers/pb2.py:114— python/ray/tune/schedulers/pb2.py:114-119 | python/ray/tune/schedulers/pb2_utils.py:198-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 both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `python/ray/tune/schedulers/pb2.py:114` it begins part-way through the construct above it, so those 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, `python/ray/tune/schedulers/pb2.py:111` calls `array`, `list`, `values` and `python/ray/tune/schedulers/pb2_utils.py:195` 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 × 2) python/ray/rllib/models/tf/tf_action_dist.py:687— python/ray/rllib/models/tf/tf_action_dist.py:687-692 | python/ray/rllib/models/torch/torch_action_dist.py:593-598 — `python/ray/rllib/models/tf/tf_action_dist.py` and `python/ray/rllib/models/torch/torch_action_dist.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 5 separate duplicated blocks between them, totalling at least 42 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) python/ray/rllib/policy/torch_policy.py:1047— python/ray/rllib/policy/torch_policy.py:1047-1052 | python/ray/rllib/policy/torch_policy_v2.py:1132-1137 — before extracting anything, compare `python/ray/rllib/policy/torch_policy.py` and `python/ray/rllib/policy/torch_policy_v2.py` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 513 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 (6 lines × 2) python/ray/rllib/utils/exploration/epsilon_greedy.py:251— python/ray/rllib/utils/exploration/epsilon_greedy.py:251-256 | python/ray/rllib/utils/exploration/gaussian_noise.py:252-257 — 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) python/ray/rllib/utils/exploration/thompson_sampling.py:23— python/ray/rllib/utils/exploration/thompson_sampling.py:23-28 | python/ray/rllib/utils/exploration/upper_confidence_bound.py:23-28 — before extracting anything, compare `python/ray/rllib/utils/exploration/thompson_sampling.py` and `python/ray/rllib/utils/exploration/upper_confidence_bound.py` as WHOLE FILES: 85% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (6 lines × 2) python/ray/rllib/utils/metrics/stats/percentiles.py:75— python/ray/rllib/utils/metrics/stats/percentiles.py:75-80 | python/ray/rllib/utils/metrics/stats/series.py:109-114 — 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) release/nightly_tests/dataset/tpch/tpch_q14.py:33— release/nightly_tests/dataset/tpch/tpch_q14.py:33-38 | release/nightly_tests/dataset/tpch/tpch_q15.py:38-44 — 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 `release/nightly_tests/dataset/tpch/tpch_q15.py:38` 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) release/nightly_tests/dataset/tpch/tpch_q20.py:53— release/nightly_tests/dataset/tpch/tpch_q20.py:53-58 | release/nightly_tests/dataset/tpch/tpch_q5.py:40-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. Read the line range as the matched WINDOW rather than a finished unit: at `release/nightly_tests/dataset/tpch/tpch_q5.py:40` it begins part-way through the construct above it, so those 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) python/ray/rllib/examples/gpus/float16_training_and_inference.py:106— python/ray/rllib/examples/gpus/float16_training_and_inference.py:106-111 | python/ray/rllib/examples/gpus/mixed_precision_training_float16_inference.py:106-111 — 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.
Swallowed exception (empty catch) release/ray_release/aws.py:55— 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) python/ray/util/check_serialize.py:232— 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) python/ray/util/tpu.py:1250— 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:253— 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:368— 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:1221— 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) python/ray/util/spark/start_ray_node.py:151— 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) python/ray/tune/utils/log.py:51— 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) python/ray/train/trainer.py:161— 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) python/ray/serve/experimental/capacity_queue_router.py:88— 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) python/ray/serve/experimental/capacity_queue_router.py:110— 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:2103— 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) python/ray/serve/_private/utils.py:269— 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) python/ray/rllib/utils/from_config.py:78— 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) python/ray/rllib/policy/sample_batch.py:92— 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) python/ray/data/datatype.py:478— 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) python/ray/data/_internal/logical/operators/read_operator.py:312— 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 (9 lines × 2) doc/source/train/doc_code/tf_starter.py:43— doc/source/train/doc_code/tf_starter.py:43-51 | python/ray/train/examples/tf/tensorflow_regression_example.py:35-43 — 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 `doc/source/train/doc_code/tf_starter.py:43` 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) python/ray/data/_internal/datasource_v2/formats/orc/orc_datasource_v2.py:173— python/ray/data/_internal/datasource_v2/formats/orc/orc_datasource_v2.py:173-181 | python/ray/data/_internal/datasource_v2/formats/parquet/parquet_datasource_v2.py:263-271 — 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) python/ray/llm/_internal/serve/core/ingress/builder.py:286— python/ray/llm/_internal/serve/core/ingress/builder.py:286-294 | python/ray/llm/_internal/serve/core/ingress/dev_ingress.py:113-121 — 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) python/ray/rllib/algorithms/ppo/ppo_torch_policy.py:123— python/ray/rllib/algorithms/ppo/ppo_torch_policy.py:123-132 | python/ray/rllib/algorithms/ppo/torch/ppo_torch_learner.py:82-90 — 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 `python/ray/rllib/algorithms/ppo/ppo_torch_policy.py:123` it begins part-way through the construct above it, so those 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) python/ray/rllib/models/tf/layers/multi_head_attention.py:18— python/ray/rllib/models/tf/layers/multi_head_attention.py:18-26 | python/ray/rllib/models/tf/layers/relative_multi_head_attention.py:46-55 — 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 `python/ray/rllib/models/tf/layers/multi_head_attention.py:18` 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) python/ray/tune/experimental/output.py:732— python/ray/tune/experimental/output.py:732-740 | python/ray/tune/experimental/output.py:748-756 — both copies are in the same file, so extract the 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 `python/ray/tune/experimental/output.py:732` 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 `trial` to `Trial` in one and `"Trial"` 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 (9 lines × 2) python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_reduce_operator.py:410— python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_reduce_operator.py:410-418 | python/ray/data/_internal/execution/operators/shuffle_operators/shuffle_reduce_operator.py:473-481 — before extracting anything, compare `python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_reduce_operator.py` and `python/ray/data/_internal/execution/operators/shuffle_operators/shuffle_reduce_operator.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 144 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 (9 lines × 2) python/ray/rllib/policy/dynamic_tf_policy.py:600— python/ray/rllib/policy/dynamic_tf_policy.py:600-608 | python/ray/rllib/policy/dynamic_tf_policy_v2.py:986-994 — before extracting anything, compare `python/ray/rllib/policy/dynamic_tf_policy.py` and `python/ray/rllib/policy/dynamic_tf_policy_v2.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 422 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 (9 lines × 2) java/runtime/src/main/java/io/ray/runtime/util/generator/ConcurrencyGroupBuilderGenerator.java:72— java/runtime/src/main/java/io/ray/runtime/util/generator/ConcurrencyGroupBuilderGenerator.java:72-80 | java/runtime/src/main/java/io/ray/runtime/util/generator/ParallelActorCallGenerator.java:18-28 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `java/runtime/src/main/java/io/ray/runtime/util/generator/ConcurrencyGroupBuilderGenerator.java:82` calls `newLine` and `java/runtime/src/main/java/io/ray/runtime/util/generator/ParallelActorCallGenerator.java:29` 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) java/runtime/src/main/java/io/ray/runtime/util/generator/ParallelActorCallGenerator.java:290— java/runtime/src/main/java/io/ray/runtime/util/generator/ParallelActorCallGenerator.java:290-298 | java/runtime/src/main/java/io/ray/runtime/util/generator/RayCallGenerator.java:409-417 — before extracting anything, compare `java/runtime/src/main/java/io/ray/runtime/util/generator/ParallelActorCallGenerator.java` and `java/runtime/src/main/java/io/ray/runtime/util/generator/RayCallGenerator.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 192 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. 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 (9 lines × 2) python/ray/rllib/examples/multi_agent/utils/self_play_league_based_callback.py:291— python/ray/rllib/examples/multi_agent/utils/self_play_league_based_callback.py:291-299 | python/ray/rllib/examples/multi_agent/utils/self_play_league_based_callback_old_api_stack.py:193-201 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `python/ray/rllib/examples/multi_agent/utils/self_play_league_based_callback.py:290` calls `pprint` and `python/ray/rllib/examples/multi_agent/utils/self_play_league_based_callback_old_api_stack.py:192` 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) python/ray/tune/examples/hyperopt_conditional_search_space_example.py:53— python/ray/tune/examples/hyperopt_conditional_search_space_example.py:53-61 | python/ray/tune/examples/optuna_define_by_run_example.py:27-35 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `python/ray/tune/examples/hyperopt_conditional_search_space_example.py:52` calls `f_unpack_dict` and `python/ray/tune/examples/optuna_define_by_run_example.py:25` 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) release/air_tests/air_benchmarks/workloads/torch_benchmark.py:26— release/air_tests/air_benchmarks/workloads/torch_benchmark.py:26-34 | REDACTED:13-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.
Duplicated block (9 lines × 2) release/nightly_tests/dataset/multi_node_train_benchmark.py:500— release/nightly_tests/dataset/multi_node_train_benchmark.py:500-508 | release/nightly_tests/dataset/multi_node_train_benchmark.py:533-541 — both copies are in the same file, so extract the 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) release/nightly_tests/dataset/tpch/tpch_q16.py:28— release/nightly_tests/dataset/tpch/tpch_q16.py:28-38 | release/nightly_tests/dataset/tpch/tpch_q21.py:54-62 — 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 `release/nightly_tests/dataset/tpch/tpch_q16.py:28` it begins part-way through the construct above it, so those 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) release/nightly_tests/dataset/profiling/perf.py:465— release/nightly_tests/dataset/profiling/perf.py:465-473 | REDACTED:465-477 — 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 (5 lines × 2) doc/source/train/doc_code/checkpoints.py:25— doc/source/train/doc_code/checkpoints.py:25-29 | doc/source/train/doc_code/metric_logging.py:35-39 — 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) python/ray/data/_internal/datasource/lerobot_datasource.py:1144— python/ray/data/_internal/datasource/lerobot_datasource.py:1144-1148 | python/ray/data/_internal/datasource/lerobot_datasource.py:1444-1448 — both copies are in the same file, so extract the 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 `python/ray/data/_internal/datasource/lerobot_datasource.py:1144` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) python/ray/data/read_api.py:5074— python/ray/data/read_api.py:5074-5080 | python/ray/data/read_api.py:5361-5365 — both copies are in the same file, so extract the 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) python/ray/rllib/models/torch/torch_action_dist.py:125— python/ray/rllib/models/torch/torch_action_dist.py:125-129 | python/ray/rllib/models/torch/torch_action_dist.py:134-138 — both copies are in the same file, so extract the 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) doc/source/serve/doc_code/intel_gaudi_inference_serve.py:72— doc/source/serve/doc_code/intel_gaudi_inference_serve.py:72-76 | doc/source/serve/doc_code/intel_gaudi_inference_serve_deepspeed.py:106-110 — 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) python/ray/data/_internal/logical/operators/from_operators.py:89— python/ray/data/_internal/logical/operators/from_operators.py:89-93 | python/ray/data/_internal/logical/operators/input_data_operator.py:53-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 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) python/ray/tune/callback.py:470— python/ray/tune/callback.py:470-489 | REDACTED:420-424 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:415` calls `has_checkpoint`, `any`, `Path` and `python/ray/tune/callback.py:467` 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 (5 lines × 2) REDACTED:412— REDACTED:412-416 | release/microbenchmark/run_microbenchmark.py:7-11 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (5 lines × 2) python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_reduce_operator.py:403— python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_reduce_operator.py:403-407 | python/ray/data/_internal/execution/operators/shuffle_operators/shuffle_reduce_operator.py:466-470 — before extracting anything, compare `python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_reduce_operator.py` and `python/ray/data/_internal/execution/operators/shuffle_operators/shuffle_reduce_operator.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 144 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 (5 lines × 2) python/ray/rllib/models/tf/tf_modelv2.py:100— python/ray/rllib/models/tf/tf_modelv2.py:100-104 | python/ray/rllib/models/torch/torch_modelv2.py:77-81 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. 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) python/ray/_private/external_storage.py:362— python/ray/_private/external_storage.py:362-366 | python/ray/_private/external_storage.py:533-537 — both copies are in the same file, so extract the 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, `python/ray/_private/external_storage.py:538` calls `read` and `python/ray/_private/external_storage.py:367` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5 lines × 2) REDACTED:36— REDACTED:36-40 | REDACTED:37-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. 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, `REDACTED:43` calls `UniqueId`, `super` and `REDACTED:42` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5 lines × 2) release/nightly_tests/dataset/profiling/analysis/analyze_pyspy_profile.py:622— release/nightly_tests/dataset/profiling/analysis/analyze_pyspy_profile.py:622-626 | release/nightly_tests/dataset/profiling/analysis/analyze_pyspy_profile.py:702-706 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) release/nightly_tests/dataset/profiling/analysis/analyze_pyspy_profile.py:653— release/nightly_tests/dataset/profiling/analysis/analyze_pyspy_profile.py:653-657 | release/nightly_tests/dataset/profiling/analysis/analyze_pyspy_profile.py:684-688 — both copies are in the same file, so extract the 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) python/ray/rllib/examples/algorithms/appo/multi_agent_pong_appo.py:40— python/ray/rllib/examples/algorithms/appo/multi_agent_pong_appo.py:40-44 | python/ray/rllib/examples/algorithms/appo/pong_appo.py:33-37 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (5 lines × 2) release/llm_tests/serve/prefix_router_lora_benchmark.py:493— release/llm_tests/serve/prefix_router_lora_benchmark.py:493-497 | release/llm_tests/serve/prefix_router_overhead_benchmark.py:218-222 — 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) doc/source/tune/doc_code/pytorch_optuna.py:28— doc/source/tune/doc_code/pytorch_optuna.py:28-42 | python/ray/tune/examples/mnist_pytorch.py:53-67 — before extracting anything, compare `doc/source/tune/doc_code/pytorch_optuna.py` and `python/ray/tune/examples/mnist_pytorch.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (15 lines × 2) python/ray/_private/utils.py:1175— python/ray/_private/utils.py:1175-1189 | python/ray/_private/utils.py:1204-1218 — both copies are in the same file, so extract the 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) python/ray/air/integrations/keras.py:171— python/ray/air/integrations/keras.py:171-185 | python/ray/train/tensorflow/keras.py:125-139 — before extracting anything, compare `python/ray/air/integrations/keras.py` and `python/ray/train/tensorflow/keras.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 (15 lines × 2) python/ray/rllib/algorithms/algorithm_config.py:5969— python/ray/rllib/algorithms/algorithm_config.py:5969-5983 | python/ray/rllib/algorithms/algorithm_config.py:6032-6046 — both copies are in the same file, so extract the 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) python/ray/rllib/algorithms/appo/appo_tf_policy.py:235— python/ray/rllib/algorithms/appo/appo_tf_policy.py:235-249 | python/ray/rllib/algorithms/appo/appo_tf_policy.py:272-286 — both copies are in the same file, so extract the 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) python/ray/rllib/algorithms/impala/impala_tf_policy.py:329— python/ray/rllib/algorithms/impala/impala_tf_policy.py:329-343 | python/ray/rllib/algorithms/marwil/marwil_tf_policy.py:198-212 — 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 `python/ray/rllib/algorithms/impala/impala_tf_policy.py:329` it begins part-way through the construct above it, so those 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) python/ray/rllib/algorithms/sac/sac_tf_model.py:332— python/ray/rllib/algorithms/sac/sac_tf_model.py:332-346 | python/ray/rllib/algorithms/sac/sac_torch_model.py:334-348 — before extracting anything, compare `python/ray/rllib/algorithms/sac/sac_tf_model.py` and `python/ray/rllib/algorithms/sac/sac_torch_model.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 93 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 `python/ray/rllib/algorithms/sac/sac_tf_model.py:332` it begins part-way through the construct above it, so those 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) python/ray/rllib/policy/dynamic_tf_policy.py:393— python/ray/rllib/policy/dynamic_tf_policy.py:393-407 | python/ray/rllib/policy/dynamic_tf_policy_v2.py:610-624 — before extracting anything, compare `python/ray/rllib/policy/dynamic_tf_policy.py` and `python/ray/rllib/policy/dynamic_tf_policy_v2.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 422 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (15 lines × 2) python/ray/rllib/policy/tf_mixins.py:79— python/ray/rllib/policy/tf_mixins.py:79-93 | python/ray/rllib/policy/torch_mixins.py:65-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 `python/ray/rllib/policy/tf_mixins.py:79` it begins part-way through the construct above it, so those 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) python/ray/rllib/utils/replay_buffers/episode_replay_buffer.py:192— python/ray/rllib/utils/replay_buffers/episode_replay_buffer.py:192-206 | python/ray/rllib/utils/replay_buffers/prioritized_episode_buffer.py:208-222 — 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) REDACTED:668— REDACTED:668-682 | python/ray/serve/_private/router.py:367-381 — 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) python/ray/serve/_private/application_state.py:1659— python/ray/serve/_private/application_state.py:1659-1673 | python/ray/serve/_private/deployment_state.py:7045-7059 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (15 lines × 2) release/ray_release/command_runner/_anyscale_job_wrapper.py:58— release/ray_release/command_runner/_anyscale_job_wrapper.py:58-72 | REDACTED:136-150 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (15 lines × 2) release/air_tests/air_benchmarks/workloads/tensorflow_benchmark.py:285— release/air_tests/air_benchmarks/workloads/tensorflow_benchmark.py:285-299 | release/air_tests/air_benchmarks/workloads/torch_benchmark.py:446-460 — before extracting anything, compare `release/air_tests/air_benchmarks/workloads/tensorflow_benchmark.py` and `release/air_tests/air_benchmarks/workloads/torch_benchmark.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 155 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 `release/air_tests/air_benchmarks/workloads/tensorflow_benchmark.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 (15 lines × 2) release/nightly_tests/dask_on_ray/dask_on_ray_sort.py:26— release/nightly_tests/dask_on_ray/dask_on_ray_sort.py:26-40 | release/nightly_tests/dask_on_ray/dask_on_ray_sort.py:84-98 — both copies are in the same file, so extract the 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, `release/nightly_tests/dask_on_ray/dask_on_ray_sort.py:41` calls `open`, `put_object` and `release/nightly_tests/dask_on_ray/dask_on_ray_sort.py:100` 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.
X17 · Uncapped recursion over a caller-supplied document· Recursive walk over a caller-supplied document has no depth cap · ×15
Recursive walk over a caller-supplied document has no depth cap python/ray/actor.py:1923— `remote` is public, takes a document from its caller (line 1717) and hands it to `_remote`, which calls itself at line 1923 (`self._remote`) with a piece of `actor_options` — and nowhere in `_remote` 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 `_remote` 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 REDACTED:278— `generate_variants` is public, takes a document from its caller (line 17) and hands it to `_generate_variants_internal`, which calls itself at line 278 (`_generate_variants_internal`) with a piece of `spec` — and nowhere in `_generate_variants_internal` 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 `_generate_variants_internal` 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 REDACTED:492— `parse_spec_vars` is public, takes a document from its caller (line 185) and hands it to `_split_resolved_unresolved_values`, which calls itself at line 492 (`_split_resolved_unresolved_values`) with a piece of `spec` — and nowhere in `_split_resolved_unresolved_values` 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 `_split_resolved_unresolved_values` 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 python/ray/tune/search/hyperopt/hyperopt_search.py:527— `convert_search_space` is public and takes `spec: Dict` from its caller, and it calls itself at line 527 (`self.convert_search_space`) with a piece of `spec` — and nowhere in `convert_search_space` 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 `convert_search_space` 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 python/ray/rllib/utils/serialization.py:37— `convert_numpy_to_python_primitives` is public and takes `obj: Any` from its caller, and it calls itself at line 37 (`convert_numpy_to_python_primitives`) with a piece of `obj` (and at line 40, line 42, line 54) — and nowhere in `convert_numpy_to_python_primitives` 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 `convert_numpy_to_python_primitives` 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 python/ray/rllib/utils/serialization.py:268— `gym_space_from_dict` is public and takes `d: Dict` from its caller, and it calls itself at line 268 (`gym_space_from_dict`) with a piece of `d` (and at line 282, line 290, line 294) — and nowhere in `gym_space_from_dict` 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 `gym_space_from_dict` 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 python/ray/rllib/utils/serialization.py:331— `space_from_dict` is public and takes `d: Dict` from its caller, and it calls itself at line 331 (`space_from_dict`) with a piece of `d` — and nowhere in `space_from_dict` 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 `space_from_dict` 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 python/ray/rllib/utils/metrics/legacy_stats.py:722— `from_state` is public and takes `state: Dict[str, Any]` from its caller, and it calls itself at line 722 (`self.from_state`) with a piece of `state` — and nowhere in `from_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_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 REDACTED:28— `is_text_only_chat` is public, takes a document from its caller (line 50) and hands it to `_is_text_content`, which calls itself at line 28 (`_is_text_content`) with a piece of `content` — and nowhere in `_is_text_content` 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 `_is_text_content` 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 python/ray/llm/_internal/common/dict_utils.py:55— `deep_merge_dicts` is public and takes `base: Dict[str, Any]` from its caller, and it calls itself at line 55 (`deep_merge_dicts`) with a piece of `base` — and nowhere in `deep_merge_dicts` 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 `deep_merge_dicts` 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 python/ray/dashboard/runtime_env_redaction.py:73— `redact_runtime_env_deep` is public and takes `payload: Any` from its caller, and it calls itself at line 73 (`redact_runtime_env_deep`) with a piece of `payload` (and at line 76) — and nowhere in `redact_runtime_env_deep` 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 `redact_runtime_env_deep` 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 REDACTED:232— `setup_wandb` is public, takes a document from its caller (line 62) and hands it to `_clean_log`, which calls itself at line 232 (`_clean_log`) with a piece of `obj` (and at line 237, line 242) — and nowhere in `_clean_log` 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 `_clean_log` 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 python/ray/air/_internal/torch_utils.py:63— `contains_tensor` is public and takes `obj: Any` from its caller, and it calls itself at line 63 (`contains_tensor`) with a piece of `obj` (and at line 65, line 69) — and nowhere in `contains_tensor` 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 `contains_tensor` 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 python/ray/_private/dict.py:81— `deep_update` is public and takes `original: dict` from its caller, and it calls itself at line 81 (`deep_update`) with a piece of `original` (and at line 89) — and nowhere in `deep_update` 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 `deep_update` 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 ci/raydepsets/workspace.py:36— `from_dict` is public, takes a document from its caller (line 68) and hands it to `_substitute_build_args`, which calls itself at line 36 (`_substitute_build_args`) with a piece of `obj` (and at line 40) — and nowhere in `_substitute_build_args` 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 `_substitute_build_args` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Duplicated block (18 lines × 2) REDACTED:409— REDACTED:409-426 | REDACTED:386-403 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 70 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 (18 lines × 2) python/ray/autoscaler/_private/kuberay/autoscaling_config.py:374— python/ray/autoscaler/_private/kuberay/autoscaling_config.py:374-391 | python/ray/autoscaler/_private/kuberay/autoscaling_config.py:406-423 — both copies are in the same file, so extract the 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 lines × 2) python/ray/data/_internal/datasource/kafka_datasource.py:306— python/ray/data/_internal/datasource/kafka_datasource.py:306-323 | python/ray/data/_internal/datasource/kafka_datasource.py:333-350 — both copies are in the same file, so extract the 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) python/ray/data/_internal/planner/_obstore_download.py:1369— python/ray/data/_internal/planner/_obstore_download.py:1369-1386 | python/ray/data/_internal/planner/plan_download_op.py:277-294 — 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 lines × 2) python/ray/llm/_internal/batch/processor/sglang_engine_proc.py:246— python/ray/llm/_internal/batch/processor/sglang_engine_proc.py:246-263 | python/ray/llm/_internal/batch/processor/vllm_engine_proc.py:323-340 — before extracting anything, compare `python/ray/llm/_internal/batch/processor/sglang_engine_proc.py` and `python/ray/llm/_internal/batch/processor/vllm_engine_proc.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 96 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 `python/ray/llm/_internal/batch/processor/sglang_engine_proc.py:246` it begins part-way through the construct above it, so those 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, `python/ray/llm/_internal/batch/processor/vllm_engine_proc.py:341` calls `get` and `python/ray/llm/_internal/batch/processor/sglang_engine_proc.py:264` 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) python/ray/rllib/models/tf/complex_input_net.py:80— python/ray/rllib/models/tf/complex_input_net.py:80-97 | python/ray/rllib/models/torch/complex_input_net.py:99-116 — `python/ray/rllib/models/tf/complex_input_net.py` and `python/ray/rllib/models/torch/complex_input_net.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 4 separate duplicated blocks between them, totalling at least 72 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 `python/ray/rllib/models/tf/complex_input_net.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 (18 lines × 2) python/ray/rllib/policy/torch_policy.py:335— python/ray/rllib/policy/torch_policy.py:335-352 | python/ray/rllib/policy/torch_policy_v2.py:524-541 — before extracting anything, compare `python/ray/rllib/policy/torch_policy.py` and `python/ray/rllib/policy/torch_policy_v2.py` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 513 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 (18 lines × 2) python/ray/rllib/policy/torch_policy.py:371— python/ray/rllib/policy/torch_policy.py:371-388 | python/ray/rllib/policy/torch_policy_v2.py:563-580 — before extracting anything, compare `python/ray/rllib/policy/torch_policy.py` and `python/ray/rllib/policy/torch_policy_v2.py` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 513 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (18 lines × 2) python/ray/serve/_private/common.py:414— python/ray/serve/_private/common.py:414-431 | python/ray/serve/_private/common.py:640-657 — both copies are in the same file, so extract the 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 `python/ray/serve/_private/common.py:414` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (18 lines × 2) python/ray/serve/_private/common.py:587— python/ray/serve/_private/common.py:587-604 | python/ray/serve/_private/common.py:624-641 — both copies are in the same file, so extract the 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 `python/ray/serve/_private/common.py:587` 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 (18 lines × 2) python/ray/rllib/utils/replay_buffers/multi_agent_prioritized_replay_buffer.py:260— python/ray/rllib/utils/replay_buffers/multi_agent_prioritized_replay_buffer.py:260-280 | python/ray/rllib/utils/replay_buffers/multi_agent_replay_buffer.py:337-354 — before extracting anything, compare `python/ray/rllib/utils/replay_buffers/multi_agent_prioritized_replay_buffer.py` and `python/ray/rllib/utils/replay_buffers/multi_agent_replay_buffer.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 80 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (18 lines × 2) python/ray/train/_internal/storage.py:275— python/ray/train/_internal/storage.py:275-292 | python/ray/train/v2/_internal/execution/storage.py:267-284 — before extracting anything, compare `python/ray/train/_internal/storage.py` and `python/ray/train/v2/_internal/execution/storage.py` as WHOLE FILES: this scan already matched 8 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. 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 (18 lines × 2) python/ray/llm/_internal/batch/stages/sglang_engine_stage.py:174— python/ray/llm/_internal/batch/stages/sglang_engine_stage.py:174-191 | python/ray/llm/_internal/batch/stages/vllm_engine_stage.py:489-506 — before extracting anything, compare `python/ray/llm/_internal/batch/stages/sglang_engine_stage.py` and `python/ray/llm/_internal/batch/stages/vllm_engine_stage.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 64 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (18 lines × 2) release/serve_tests/workloads/benchmark_utils.py:49— release/serve_tests/workloads/benchmark_utils.py:49-66 | release/serve_tests/workloads/benchmark_utils.py:73-90 — both copies are in the same file, so extract the 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.
R4 · Test Coverage· No test reaches this file · ×14
No test reaches this file python/ray/dashboard/client/src/pages/actor/hook/mockedUseActorList.ts: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 python/ray/dashboard/client/src/common/SortableTableHead.tsx: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 python/ray/dashboard/client/src/pages/serve/mockServeApplication.ts: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 python/ray/dashboard/client/src/common/tableUtils.ts: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 python/ray/dashboard/client/src/common/AlertDialog.tsx: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 python/ray/dashboard/client/src/common/NumberedLines.tsx: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 python/ray/dashboard/client/src/common/LabeledDatum.tsx: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 python/ray/dashboard/client/src/common/UsageStatsAlert.tsx: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 python/ray/dashboard/client/src/pages/error/404.tsx: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 python/ray/dashboard/client/src/common/ExpandControls.tsx: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 python/ray/dashboard/client/src/common/TableCell.tsx: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 python/ray/dashboard/client/src/index.tsx: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 python/ray/dashboard/client/src/common/SpanButton.tsx: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 python/ray/dashboard/client/src/service/cluster.ts: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.
HackComment release/train_tests/benchmark/recsys/criteo.py:244— # HACK: Dummy encoding for quicker testing. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment python/ray/tune/schedulers/hb_bohb.py:124— # Hack. See comment in on_trial_result — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment python/ray/train/_internal/backend_executor.py:177— # Hack to avoid OOMs. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment python/ray/data/datasource/file_meta_provider.py:241— # HACK: PyArrow's `ParquetDataset` errors if input paths contain non-parquet — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment python/ray/data/_internal/arrow_block.py:580— # HACK: For v1 and v2 tensors, we can control what is returned — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment python/ray/data/_internal/logical/operators/read_operator.py:138— # HACK: Try to get a single read task to get the metadata. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment python/ray/data/_internal/execution/operators/actor_pool_map_operator.py:200— # HACK: Without this, all actors show up as `_MapWorker` in Grafana, so we can’t — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment REDACTED:421— # Hack to circumvent non-predictable memoization caused by string interning. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment REDACTED:715— # Hack to circumvent non-predictable memoization caused by string interning. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment REDACTED:744— # Hack to circumvent non-predictable memoization caused by string interning. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment REDACTED:834— # Hack to circumvent non-predictable memoization caused by string interning. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment python/ray/_private/services.py:344— # HACK: Workaround for UNIX idiosyncrasy — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
Duplicated block (20 lines × 2) ci/ray_ci/automation/docker_tags_lib.py:160— ci/ray_ci/automation/docker_tags_lib.py:160-179 | ci/ray_ci/automation/list_docker_tags.py:24-43 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (20 lines × 2) python/ray/data/_internal/tensor_extensions/pandas.py:68— python/ray/data/_internal/tensor_extensions/pandas.py:68-87 | python/ray/data/_internal/tensor_extensions/pandas.py:113-132 — both copies are in the same file, so extract the 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 `python/ray/data/_internal/tensor_extensions/pandas.py:68` 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 lines × 2) REDACTED:1682— REDACTED:1682-1701 | REDACTED:1848-1869 — both copies are in the same file, so extract the 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: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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:1679` calls `col`, `TypeError` and `REDACTED:1848` 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) python/ray/rllib/algorithms/algorithm_config.py:2168— python/ray/rllib/algorithms/algorithm_config.py:2168-2187 | python/ray/rllib/algorithms/algorithm_config.py:4137-4156 — both copies are in the same file, so extract the 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 `python/ray/rllib/algorithms/algorithm_config.py:2168` it begins part-way through the construct above it, so those 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 lines × 2) python/ray/rllib/core/models/torch/encoder.py:124— python/ray/rllib/core/models/torch/encoder.py:124-143 | python/ray/rllib/core/models/torch/encoder.py:207-226 — both copies are in the same file, so extract the 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) python/ray/rllib/models/tf/attention_net.py:504— python/ray/rllib/models/tf/attention_net.py:504-523 | python/ray/rllib/models/torch/attention_net.py:378-397 — `python/ray/rllib/models/tf/attention_net.py` and `python/ray/rllib/models/torch/attention_net.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 5 separate duplicated blocks between them, totalling at least 114 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (20 lines × 2) python/ray/rllib/policy/torch_policy.py:1003— python/ray/rllib/policy/torch_policy.py:1003-1022 | python/ray/rllib/policy/torch_policy_v2.py:1091-1110 — before extracting anything, compare `python/ray/rllib/policy/torch_policy.py` and `python/ray/rllib/policy/torch_policy_v2.py` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 513 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 `python/ray/rllib/policy/torch_policy.py:1003` it begins part-way through the construct above it, so those 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 lines × 2) python/ray/serve/schema.py:348— python/ray/serve/schema.py:348-367 | python/ray/serve/schema.py:904-923 — both copies are in the same file, so extract the 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 lines × 2) python/ray/train/lightgbm/lightgbm_trainer.py:292— python/ray/train/lightgbm/lightgbm_trainer.py:292-311 | python/ray/train/xgboost/xgboost_trainer.py:278-297 — 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 `python/ray/train/lightgbm/lightgbm_trainer.py:292` 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 lines × 2) python/ray/tune/search/concurrency_limiter.py:92— python/ray/tune/search/concurrency_limiter.py:92-111 | python/ray/tune/search/searcher.py:531-550 — before extracting anything, compare `python/ray/tune/search/concurrency_limiter.py` and `python/ray/tune/search/searcher.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 65 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 (20 lines × 2) release/air_tests/air_benchmarks/workloads/torch_benchmark.py:188— release/air_tests/air_benchmarks/workloads/torch_benchmark.py:188-207 | release/train_tests/elastic_training/torch_elastic_e2e.py:147-166 — 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 (20 lines × 2) release/nightly_tests/dataset/profiling/perf.py:148— release/nightly_tests/dataset/profiling/perf.py:148-167 | REDACTED:313-332 — 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.
Sync-over-async blocking REDACTED:248— `run_and_stream_logs` is async and calls subprocess.check_call — a blocking call inside async code stalls the event loop — every other task on it waits for as long as it runs.
Sync-over-async blocking release/benchmarks/distributed/many_nodes_tests/dashboard_test.py:65— `ping` is async and calls requests.get — a blocking call inside async code stalls the event loop — every other task on it waits for as long as it runs.
Sync-over-async blocking release/long_running_tests/workloads/serve.py:59— `handle_batch` is async and calls time.sleep — a blocking call inside async code stalls the event loop — every other task on it waits for as long as it runs.
Sync-over-async blocking release/serve_tests/workloads/resnet_50.py:37— `__call__` is async and calls requests.get — a blocking call inside async code stalls the event loop — every other task on it waits for as long as it runs.
Sync-over-async blocking doc/source/serve/doc_code/asyncio_best_practices.py:59— `__call__` is async and calls requests.get — a blocking call inside async code stalls the event loop — every other task on it waits for as long as it runs.
Sync-over-async blocking doc/source/serve/doc_code/resnet50_example.py:43— `__call__` is async and calls requests.get — a blocking call inside async code stalls the event loop — every other task on it waits for as long as it runs.
Sync-over-async blocking doc/source/serve/doc_code/whisper_example.py:53— `transcribe` is async and calls subprocess.check_call — a blocking call inside async code stalls the event loop — every other task on it waits for as long as it runs.
Sync-over-async blocking python/ray/_private/ray_microbenchmark_helpers.py:51— `asyncio_timeit` is async and calls time.sleep — a blocking call inside async code stalls the event loop — every other task on it waits for as long as it runs.
Sync-over-async blocking python/ray/_private/runtime_env/agent/runtime_env_agent.py:472— `GetOrCreateRuntimeEnv` is async and calls time.sleep — a blocking call inside async code stalls the event loop — every other task on it waits for as long as it runs.
Sync-over-async blocking python/ray/llm/examples/serve/example_reset_kv_cache/reset_kv_cache_example.py:146— `main` is async and calls time.sleep — a blocking call inside async code stalls the event loop — every other task on it waits for as long as it runs.
Sync-over-async blocking python/ray/serve/_private/benchmarks/streaming/streaming_grpc_throughput.py:106— `run_grpc_benchmark` is async and calls time.sleep — a blocking call inside async code stalls the event loop — every other task on it waits for as long as it runs.
D4 · Code Duplication· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×10
Members sharing a duplicated core (4 members, 50+ identical tokens) doc/source/tune/doc_code/pytorch_optuna.py:28— doc/source/tune/doc_code/pytorch_optuna.py:28-42 | python/ray/tune/examples/cifar10_pytorch.py:84-187 | python/ray/tune/examples/cifar10_pytorch.py:193-222 | python/ray/tune/examples/mnist_pytorch.py:53-67 — 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) python/ray/dashboard/modules/reporter/profile_manager.py:92— python/ray/dashboard/modules/reporter/profile_manager.py:92-128 | python/ray/dashboard/modules/reporter/profile_manager.py:139-206 | python/ray/dashboard/modules/reporter/profile_manager.py:283-335 | python/ray/dashboard/modules/reporter/profile_manager.py:342-376 — 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) python/ray/data/read_api.py:4565— python/ray/data/read_api.py:4565-4721 | python/ray/data/read_api.py:4746-4830 | python/ray/data/read_api.py:5944-6044 | python/ray/data/read_api.py:6071-6160 — 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:549— REDACTED:549-571 | REDACTED:593-618 | REDACTED:623-650 | REDACTED:653-680 — 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) python/ray/rllib/algorithms/cql/torch/cql_torch_learner.py:42— python/ray/rllib/algorithms/cql/torch/cql_torch_learner.py:42-245 | python/ray/rllib/algorithms/sac/torch/sac_torch_learner.py:157-268 | python/ray/rllib/algorithms/sac/torch/sac_torch_learner.py:279-400 | python/ray/rllib/algorithms/tqc/torch/tqc_torch_learner.py:155-284 — 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) python/ray/rllib/models/tf/attention_net.py:409— python/ray/rllib/models/tf/attention_net.py:409-495 | python/ray/rllib/models/tf/recurrent_net.py:145-223 | python/ray/rllib/models/torch/attention_net.py:278-369 | python/ray/rllib/models/torch/recurrent_net.py:139-208 — 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) python/ray/rllib/utils/replay_buffers/episode_replay_buffer.py:188— python/ray/rllib/utils/replay_buffers/episode_replay_buffer.py:188-323 | python/ray/rllib/utils/replay_buffers/multi_agent_episode_buffer.py:186-353 | python/ray/rllib/utils/replay_buffers/multi_agent_prioritized_episode_buffer.py:211-457 | python/ray/rllib/utils/replay_buffers/prioritized_episode_buffer.py:181-358 — 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) python/ray/rllib/examples/algorithms/dqn/benchmark_dqn_atari.py:266— python/ray/rllib/examples/algorithms/dqn/benchmark_dqn_atari.py:266-281 | python/ray/rllib/examples/algorithms/dqn/benchmark_dqn_atari_rllib_preprocessing.py:256-271 | python/ray/rllib/examples/algorithms/ppo/benchmark_ppo_mujoco.py:61-76 | python/ray/rllib/examples/algorithms/sac/benchmark_sac_mujoco.py:52-67 — 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) python/ray/train/examples/horovod/horovod_example.py:26— python/ray/train/examples/horovod/horovod_example.py:26-31 | python/ray/train/examples/horovod/horovod_pytorch_example.py:27-32 | python/ray/tune/examples/pbt_dcgan_mnist/common.py:130-135 | release/ml_user_tests/horovod/horovod_example.py:24-29 — 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) python/ray/train/examples/horovod/horovod_example.py:34— python/ray/train/examples/horovod/horovod_example.py:34-40 | python/ray/train/examples/horovod/horovod_pytorch_example.py:35-41 | python/ray/tune/examples/pbt_dcgan_mnist/common.py:138-144 | release/ml_user_tests/horovod/horovod_example.py:32-38 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Duplicated block (24 lines × 2) python/ray/autoscaler/_private/aliyun/node_provider.py:159— python/ray/autoscaler/_private/aliyun/node_provider.py:159-182 | python/ray/autoscaler/_private/aws/node_provider.py:208-231 — 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 (24 lines × 2) python/ray/autoscaler/_private/kuberay/node_provider.py:504— python/ray/autoscaler/_private/kuberay/node_provider.py:504-527 | python/ray/autoscaler/v2/instance_manager/cloud_providers/kuberay/cloud_provider.py:611-634 — 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 (24 lines × 2) REDACTED:1112— REDACTED:1112-1135 | REDACTED:1685-1708 — both copies are in the same file, so extract the 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 (24 lines × 2) python/ray/rllib/algorithms/dqn/dqn_tf_policy.py:161— python/ray/rllib/algorithms/dqn/dqn_tf_policy.py:161-184 | python/ray/rllib/algorithms/dqn/dqn_torch_policy.py:155-178 — 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 (24 lines × 2) python/ray/rllib/policy/dynamic_tf_policy.py:571— python/ray/rllib/policy/dynamic_tf_policy.py:571-594 | python/ray/rllib/policy/dynamic_tf_policy_v2.py:957-980 — before extracting anything, compare `python/ray/rllib/policy/dynamic_tf_policy.py` and `python/ray/rllib/policy/dynamic_tf_policy_v2.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 422 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 (24 lines × 2) python/ray/rllib/utils/replay_buffers/episode_replay_buffer.py:1044— python/ray/rllib/utils/replay_buffers/episode_replay_buffer.py:1044-1067 | python/ray/rllib/utils/replay_buffers/prioritized_episode_buffer.py:593-616 — 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 `python/ray/rllib/utils/replay_buffers/episode_replay_buffer.py:1044` 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 (24 lines × 2) python/ray/tune/search/concurrency_limiter.py:116— python/ray/tune/search/concurrency_limiter.py:116-139 | python/ray/tune/search/searcher.py:555-578 — before extracting anything, compare `python/ray/tune/search/concurrency_limiter.py` and `python/ray/tune/search/searcher.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 65 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 (24 lines × 2) release/nightly_tests/dataset/benchmark.py:224— release/nightly_tests/dataset/benchmark.py:224-247 | release/nightly_tests/multimodal_inference_benchmarks/benchmark.py:224-247 — `release/nightly_tests/dataset/benchmark.py` and `release/nightly_tests/multimodal_inference_benchmarks/benchmark.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 9 separate duplicated blocks between them, totalling at least 302 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 (24 lines × 2) release/nightly_tests/dataset/benchmark.py:482— release/nightly_tests/dataset/benchmark.py:482-505 | release/nightly_tests/multimodal_inference_benchmarks/benchmark.py:482-505 — `release/nightly_tests/dataset/benchmark.py` and `release/nightly_tests/multimodal_inference_benchmarks/benchmark.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 9 separate duplicated blocks between them, totalling at least 302 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 (24 lines × 2) release/nightly_tests/dataset/gpu_batch_inference.py:49— release/nightly_tests/dataset/gpu_batch_inference.py:49-72 | release/nightly_tests/dataset/image_classification_from_parquet/main.py:52-75 — before extracting anything, compare `release/nightly_tests/dataset/gpu_batch_inference.py` and `release/nightly_tests/dataset/image_classification_from_parquet/main.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 115 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.
Change coupling: sglang_engine_proc.py ↔ vllm_engine_proc.py python/ray/llm/_internal/batch/processor/sglang_engine_proc.py:1— `python/ray/llm/_internal/batch/processor/sglang_engine_proc.py` and `python/ray/llm/_internal/batch/processor/vllm_engine_proc.py` change together 87% of the time (13 of the 15 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 13 shared commits counted here, the most recent 3 are `6118c1ac` [data][llm] Defer heavy engine imports from ray.data.llm (#64990); `9a6c58ed` [serve,data][llm] LLM telemetry bugfixes (#63782); `75f55e33` [data][llm] Promote `max_tasks_in_flight_per_actor` to a first-class … — run `git show` on any of them.
Change coupling: collective_tensor_transport.py ↔ rdt_store.py python/ray/experimental/rdt/collective_tensor_transport.py:1— `python/ray/experimental/rdt/collective_tensor_transport.py` and `python/ray/experimental/rdt/rdt_store.py` change together 77% of the time (10 of the 13 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 10 shared commits counted here, the most recent 3 are `20bf6826` [core][rdt] Abort NIXL and allow actor reuse on failed transfers (#5… (at that commit the files were still `python/ray/experimental/collective/collective_tensor_transport.py` and `python/ray/experimental/gpu_object_manager/gpu_object_store.py`); `6e72c84a` [core][rdt] Reuse previous metadata if transferring the same tensor l… (at that commit the files were still `python/ray/experimental/collective/collective_tensor_transport.py` and `python/ray/experimental/gpu_object_manager/gpu_object_store.py`); `f8732a19` [core][RDT] Fix nixl garbage collection after the object is freed (#5… (at that commit the files were still `python/ray/experimental/collective/collective_tensor_transport.py` and `python/ray/experimental/gpu_object_manager/gpu_object_store.py`) — run `git show` on any of them.
Change coupling: arrow_block.py ↔ pandas_block.py python/ray/data/_internal/arrow_block.py:1— `python/ray/data/_internal/arrow_block.py` and `python/ray/data/_internal/pandas_block.py` change together 66% of the time (27 of the 41 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 27 shared commits counted here, the most recent 3 are `aa608b18` [Data] Restore KeyError on missing row columns and stop unwrapping te…; `04428dc9` [Data] Index block rows directly instead of materializing a one-row t…; `f43ccb9b` [Data] Fix Arrow-backed to_pandas regressions: opt-out flag + int/flo… — run `git show` on any of them.
Change coupling: map_operator.py ↔ zip_operator.py python/ray/data/_internal/execution/operators/map_operator.py:1— `python/ray/data/_internal/execution/operators/map_operator.py` and `python/ray/data/_internal/execution/operators/zip_operator.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, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 `02d61afb` [Data] Make `RefBundle` and other classes properly frozen (#61059); `0906625f` [Data] Added metrics to track task scheduling time, output backpressu…; `db066181` [data][2/n] Ordered + FIFO bundle queue (#60228) — run `git show` on any of them.
Change coupling: gpu_batch_inference.py ↔ main.py release/nightly_tests/dataset/gpu_batch_inference.py:1— `release/nightly_tests/dataset/gpu_batch_inference.py` and `release/nightly_tests/dataset/image_embedding_from_uris/main.py` change together 55% of the time (6 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 `d3757c6b` [data] Move non-data related stuff oustide release test timing (#65268); `c5791d40` [Data] Modify eligible release tests to use map_batches(batch_size=au…; `ea64748e` [data][release] Use get_stats_summary() in release tests (#62453) — run `git show` on any of them.
Change coupling: main.py ↔ agent.py python/ray/_private/runtime_env/agent/main.py:1— `python/ray/_private/runtime_env/agent/main.py` and `python/ray/dashboard/agent.py` change together 55% of the time (6 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 `e27a09dc` [core] Support Viewing PIDs for Dashboard and Runtime Env Agent (#58701); `28ee6df8` Revert "[Core] Bind runtime env agent and dashboard agent server to s…; `8a7176db` [Core] Bind runtime env agent and dashboard agent server to specified… — run `git show` on any of them.
Change coupling: glue.py ↔ REDACTED release/ray_release/glue.py:1— `release/ray_release/glue.py` and `REDACTED` change together 55% of the time (6 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 `f4d50dea` [release test] removes cluster_url and cluster_id (#59776); `481efca0` [release test] move `upload_working_dir_to_gcs` to `glue.py` (#57681); `1775318e` [release test] move cluster env utils to `anyscale_util` (#57669) — run `git show` on any of them.
Change coupling: REDACTED ↔ REDACTED python/ray/train/v2/_internal/execution/controller/controller.py:1— `python/ray/train/v2/_internal/execution/controller/controller.py` and `python/ray/train/v2/_internal/execution/worker_group/worker.py` change together 52% of the time (12 of the 23 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 12 shared commits counted here, the most recent 3 are `27b0e6a7` [train][Preemption handling 3/n] Add public preemption API and contro…; `6f37e6dc` [Train] Allow `DataParallelTrainer`'s `train_fn` to return data (#62021); `89e91d8d` [train] Update async validation API (#59428) — run `git show` on any of them.
Duplicated block (21 lines × 2) python/ray/_private/metrics_agent.py:444— python/ray/_private/metrics_agent.py:444-464 | python/ray/_private/prometheus_exporter.py:173-193 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (21 lines × 2) python/ray/air/util/data_batch_conversion.py:199— python/ray/air/util/data_batch_conversion.py:199-219 | python/ray/data/util/data_batch_conversion.py:155-175 — before extracting anything, compare `python/ray/air/util/data_batch_conversion.py` and `python/ray/data/util/data_batch_conversion.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 113 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (21 lines × 2) python/ray/data/preprocessors/encoder.py:249— python/ray/data/preprocessors/encoder.py:249-269 | python/ray/data/preprocessors/encoder.py:526-546 — both copies are in the same file, so extract the 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) python/ray/rllib/connectors/connector_pipeline_v2.py:182— python/ray/rllib/connectors/connector_pipeline_v2.py:182-202 | python/ray/rllib/connectors/connector_pipeline_v2.py:218-238 — both copies are in the same file, so extract the 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 `name_or_class` to `Union[str, type]` in one and `Union[str, Type]` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (21 lines × 2) python/ray/rllib/models/tf/recurrent_net.py:156— python/ray/rllib/models/tf/recurrent_net.py:156-176 | python/ray/rllib/models/torch/recurrent_net.py:153-173 — `python/ray/rllib/models/tf/recurrent_net.py` and `python/ray/rllib/models/torch/recurrent_net.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 3 separate duplicated blocks between them, totalling at least 51 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `python/ray/rllib/models/torch/recurrent_net.py:152` calls `get` and `python/ray/rllib/models/tf/recurrent_net.py:155` 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 lines × 2) python/ray/rllib/policy/torch_policy.py:750— python/ray/rllib/policy/torch_policy.py:750-770 | python/ray/rllib/policy/torch_policy_v2.py:942-962 — before extracting anything, compare `python/ray/rllib/policy/torch_policy.py` and `python/ray/rllib/policy/torch_policy_v2.py` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 513 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 (21 lines × 2) python/ray/tune/search/concurrency_limiter.py:48— python/ray/tune/search/concurrency_limiter.py:48-68 | python/ray/tune/search/searcher.py:487-507 — before extracting anything, compare `python/ray/tune/search/concurrency_limiter.py` and `python/ray/tune/search/searcher.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 65 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 (21 lines × 2) python/ray/rllib/core/learner/differentiable_learner.py:205— python/ray/rllib/core/learner/differentiable_learner.py:205-225 | python/ray/rllib/core/learner/learner.py:971-992 — before extracting anything, compare `python/ray/rllib/core/learner/differentiable_learner.py` and `python/ray/rllib/core/learner/learner.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 141 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.
AC2 · Forms & labels· <TextField> field component without a label · ×7
<TextField> field component without a label python/ray/dashboard/client/src/pages/serve/ServeDeploymentMetricsSection.tsx:135— This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing it renders carries one either (a name prop is the form-submission key, not a label). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<TextField> field component without a label python/ray/dashboard/client/src/pages/serve/ServeDeploymentMetricsSection.tsx:159— This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing it renders carries one either (a name prop is the form-submission key, not a label). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<TextField> field component without a label python/ray/dashboard/client/src/pages/serve/ServeEntityLogViewer.tsx:195— This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing it renders carries one either (a name prop is the form-submission key, not a label). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<TextField> field component without a label python/ray/dashboard/client/src/pages/serve/ServeEntityLogViewer.tsx:257— This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing it renders carries one either (a name prop is the form-submission key, not a label). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<TextField> field component without a label python/ray/dashboard/client/src/pages/serve/ServeEntityLogViewer.tsx:287— This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing it renders carries one either (a name prop is the form-submission key, not a label). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<TextField> field component without a label python/ray/dashboard/client/src/pages/serve/ServeMetricsSection.tsx:149— This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing it renders carries one either (a name prop is the form-submission key, not a label). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<TextField> field component without a label python/ray/dashboard/client/src/pages/serve/ServeMetricsSection.tsx:173— This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing it renders carries one either (a name prop is the form-submission key, not a label). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
FixmeComment release/nightly_tests/dataset/read_and_consume_benchmark.py:104— # FIXME: We specify the mode as a workaround for — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment release/nightly_tests/dataset/text_embedding/main.py:37— # FIXME: We need to explicitly define the schema and specify lists of variable-size — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment python/ray/util/dask/__init__.py:51— # FIXME(Clark): Monkey patching is bad and we should try to avoid this. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment python/ray/llm/_internal/batch/stages/base.py:160— # FIXME: This should not happen. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment python/ray/data/read_api.py:5702— # FIXME: `as_numpy_iterator` errors if `dataset` contains ragged tensors. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment python/ray/data/preprocessors/encoder.py:1230— # FIXME: the arrow format path is broken: https://anyscale1.atlassian.net/browse/DATA-1788
FixmeComment python/ray/autoscaler/_private/aws/utils.py:96— # fixme: replace with a Github URL that points — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
Duplicated block (22 lines × 2) REDACTED:340— REDACTED:340-361 | REDACTED:317-338 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 70 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 (22 lines × 2) REDACTED:378— REDACTED:378-399 | REDACTED:355-376 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 70 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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: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.
Duplicated block (22 lines × 2) python/ray/air/_internal/tensorflow_utils.py:14— python/ray/air/_internal/tensorflow_utils.py:14-35 | python/ray/data/_internal/utils/tensorflow_utils.py:19-40 — before extracting anything, compare `python/ray/air/_internal/tensorflow_utils.py` and `python/ray/data/_internal/utils/tensorflow_utils.py` as WHOLE FILES: 93% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (22 lines × 2) python/ray/dag/compiled_dag_node.py:2793— python/ray/dag/compiled_dag_node.py:2793-2814 | python/ray/dag/compiled_dag_node.py:3101-3122 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `python/ray/dag/compiled_dag_node.py:3061` calls `experimental_compile` and `python/ray/dag/compiled_dag_node.py:2776` 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 (22 lines × 2) python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_reduce_operator.py:220— python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_reduce_operator.py:220-241 | python/ray/data/_internal/execution/operators/shuffle_operators/shuffle_reduce_operator.py:265-286 — before extracting anything, compare `python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_reduce_operator.py` and `python/ray/data/_internal/execution/operators/shuffle_operators/shuffle_reduce_operator.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (22 lines × 2) python/ray/llm/_internal/batch/stages/sglang_engine_stage.py:348— python/ray/llm/_internal/batch/stages/sglang_engine_stage.py:348-369 | python/ray/llm/_internal/batch/stages/vllm_engine_stage.py:885-906 — before extracting anything, compare `python/ray/llm/_internal/batch/stages/sglang_engine_stage.py` and `python/ray/llm/_internal/batch/stages/vllm_engine_stage.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 64 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (22 lines × 2) python/ray/serve/_private/common.py:482— python/ray/serve/_private/common.py:482-503 | python/ray/serve/_private/common.py:534-555 — both copies are in the same file, so extract the 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 `python/ray/serve/_private/common.py:482` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (23 lines × 2) python/ray/_private/services.py:1191— python/ray/_private/services.py:1191-1213 | python/ray/_private/services.py:1343-1374 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `python/ray/_private/services.py: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 (23 lines × 2) python/ray/rllib/policy/dynamic_tf_policy.py:227— python/ray/rllib/policy/dynamic_tf_policy.py:227-249 | python/ray/rllib/policy/dynamic_tf_policy_v2.py:416-438 — before extracting anything, compare `python/ray/rllib/policy/dynamic_tf_policy.py` and `python/ray/rllib/policy/dynamic_tf_policy_v2.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 422 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 (23 lines × 2) python/ray/rllib/policy/torch_policy.py:498— python/ray/rllib/policy/torch_policy.py:498-520 | python/ray/rllib/policy/torch_policy_v2.py:675-697 — before extracting anything, compare `python/ray/rllib/policy/torch_policy.py` and `python/ray/rllib/policy/torch_policy_v2.py` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 513 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 `python/ray/rllib/policy/torch_policy.py:498` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (23 lines × 2) python/ray/train/torch/train_loop_utils.py:475— python/ray/train/torch/train_loop_utils.py:475-497 | python/ray/train/v2/torch/train_loop_utils.py:229-251 — 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 (23 lines × 2) REDACTED:113— REDACTED:113-135 | REDACTED:150-172 — both copies are in the same file, so extract the 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, `REDACTED:138` calls `_push_image` and `REDACTED:173` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (23 lines × 2) python/ray/llm/_internal/batch/stages/sglang_engine_stage.py:276— python/ray/llm/_internal/batch/stages/sglang_engine_stage.py:276-298 | python/ray/llm/_internal/batch/stages/vllm_engine_stage.py:685-708 — before extracting anything, compare `python/ray/llm/_internal/batch/stages/sglang_engine_stage.py` and `python/ray/llm/_internal/batch/stages/vllm_engine_stage.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 64 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 (17–19 lines × 2) REDACTED:1829— REDACTED:1829-1845 | REDACTED:1892-1910 — both copies are in the same file, so extract the 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:1829` it begins part-way through the construct above it, so those 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 (17–19 lines × 2) REDACTED:1582— REDACTED:1582-1600 | REDACTED:194-210 — 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:1582` it begins part-way through the construct above it, so those 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–19 lines × 2) python/ray/data/read_api.py:1537— python/ray/data/read_api.py:1537-1553 | python/ray/data/read_api.py:2447-2465 — both copies are in the same file, so extract the 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 `python/ray/data/read_api.py:1537` it begins part-way through the construct above it, so those 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–19 lines × 2) python/ray/rllib/algorithms/dqn/dqn_tf_policy.py:418— python/ray/rllib/algorithms/dqn/dqn_tf_policy.py:418-434 | python/ray/rllib/algorithms/dqn/dqn_torch_policy.py:443-461 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (17–19 lines × 2) release/nightly_tests/dataset/tpch/tpch_q5.py:92— release/nightly_tests/dataset/tpch/tpch_q5.py:92-108 | release/nightly_tests/dataset/tpch/tpch_q7.py:86-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 `release/nightly_tests/dataset/tpch/tpch_q7.py:86` it begins part-way through the construct above it, so those 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–19 lines × 2) release/serve_tests/workloads/plot_controller_benchmark.py:193— release/serve_tests/workloads/plot_controller_benchmark.py:193-211 | release/serve_tests/workloads/plot_router_benchmark.py:378-394 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (17 lines × 2) python/ray/rllib/utils/replay_buffers/multi_agent_prioritized_episode_buffer.py:391— python/ray/rllib/utils/replay_buffers/multi_agent_prioritized_episode_buffer.py:391-407 | python/ray/rllib/utils/replay_buffers/prioritized_episode_buffer.py:302-318 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `python/ray/rllib/utils/replay_buffers/multi_agent_prioritized_episode_buffer.py:409` calls `_add_new_module_indices` and `python/ray/rllib/utils/replay_buffers/prioritized_episode_buffer.py:319` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (17 lines × 2) python/ray/serve/_private/common.py:436— python/ray/serve/_private/common.py:436-452 | python/ray/serve/_private/common.py:604-620 — both copies are in the same file, so extract the 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) python/ray/util/client/client_pickler.py:94— python/ray/util/client/client_pickler.py:94-110 | python/ray/util/client/client_pickler.py:112-128 — both copies are in the same file, so extract the 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) release/air_tests/air_benchmarks/workloads/torch_benchmark.py:63— release/air_tests/air_benchmarks/workloads/torch_benchmark.py:63-79 | release/train_tests/elastic_training/torch_elastic_e2e.py:72-88 — 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 (17 lines × 2) release/nightly_tests/dataset/backpressure_benchmark.py:68— release/nightly_tests/dataset/backpressure_benchmark.py:68-84 | release/nightly_tests/dataset/backpressure_benchmark.py:100-116 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) release/nightly_tests/dataset/heterogeneous_memory_batch_inference.py:159— release/nightly_tests/dataset/heterogeneous_memory_batch_inference.py:159-175 | release/nightly_tests/dataset/heterogeneous_memory_batch_inference_multitenancy.py:215-231 — 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 (28 lines × 2) python/ray/air/util/data_batch_conversion.py:221— python/ray/air/util/data_batch_conversion.py:221-248 | python/ray/data/util/data_batch_conversion.py:177-204 — before extracting anything, compare `python/ray/air/util/data_batch_conversion.py` and `python/ray/data/util/data_batch_conversion.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 113 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: `TENSOR_COLUMN_NAME` names `ray.air.constants` in one and `ray.data.constants` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `python/ray/data/util/data_batch_conversion.py:206` calls `_lazy_import_cudf`, `isinstance`, `_convert_pandas_to_batch_type` and `python/ray/air/util/data_batch_conversion.py:249` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (28 lines × 2) python/ray/llm/_internal/batch/stages/serve_deployment_stage.py:209— python/ray/llm/_internal/batch/stages/serve_deployment_stage.py:209-236 | python/ray/llm/_internal/batch/stages/vllm_engine_stage.py:788-815 — 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 (28 lines × 2) python/ray/rllib/models/catalog.py:453— python/ray/rllib/models/catalog.py:453-480 | python/ray/rllib/models/catalog.py:527-554 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (28 lines × 2) python/ray/train/torch/train_loop_utils.py:579— python/ray/train/torch/train_loop_utils.py:579-606 | python/ray/train/v2/torch/train_loop_utils.py:357-384 — 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 (28 lines × 2) python/ray/train/examples/experiment_tracking/torch_exp_tracking_mlflow.py:41— python/ray/train/examples/experiment_tracking/torch_exp_tracking_mlflow.py:41-68 | python/ray/train/examples/experiment_tracking/torch_exp_tracking_wandb.py:37-64 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `python/ray/train/examples/experiment_tracking/torch_exp_tracking_mlflow.py:41` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Unstable project //src/ray/raylet:agent_manager — //src/ray/raylet:agent_manager has instability 0.89 with 1 dependents.
Unstable project //src/ray/raylet:worker — //src/ray/raylet:worker has instability 0.83 with 2 dependents.
Unstable project //src/ray/raylet:worker_killing_policy_factory — //src/ray/raylet:worker_killing_policy_factory has instability 0.88 with 1 dependents.
Unstable project //src/ray/raylet:worker_pool — //src/ray/raylet:worker_pool has instability 0.82 with 4 dependents.
Unstable project //src/ray/raylet:worker_pool_interface — //src/ray/raylet:worker_pool_interface has instability 0.86 with 1 dependents.
X1 · Async correctness· Task from `self._event_loop.create_task` is not kept · ×5
Task from `self._event_loop.create_task` is not kept REDACTED:475— 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.
Task from `self._event_loop.create_task` is not kept REDACTED:494— 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.
Task from `self._event_loop.create_task` is not kept REDACTED:534— 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.
Task from `self._event_loop.create_task` is not kept python/ray/serve/_private/request_router/request_router.py:953— 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.
Task from `self._event_loop.create_task` is not kept python/ray/serve/_private/request_router/request_router.py:1118— 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.
X15 · Unvalidated length from an untrusted reader· Length read from the parsed input is spent without ever being bounded · ×5
Length read from the parsed input is spent without ever being bounded python/ray/_private/external_storage.py:368— `address_len` is read from the bytes being parsed at line 363 (`int.from_bytes(… 8 bytes …)`), then passed as the size of `read` at line 368 — and nowhere in its function is `address_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 `address_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 python/ray/_private/external_storage.py:369— `metadata_len` is read from the bytes being parsed at line 364 (`int.from_bytes(… 8 bytes …)`), then passed as the size of `read` at line 369 — and nowhere in its function is `metadata_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 `metadata_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 python/ray/_private/external_storage.py:538— `address_len` is read from the bytes being parsed at line 534 (`int.from_bytes(… 8 bytes …)`), then passed as the size of `read` at line 538 — and nowhere in its function is `address_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 `address_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 python/ray/_private/external_storage.py:540— `metadata_len` is read from the bytes being parsed at line 535 (`int.from_bytes(… 8 bytes …)`), then passed as the size of `read` at line 540 — and nowhere in its function is `metadata_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 `metadata_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 java/runtime/src/main/java/io/ray/runtime/object/ObjectRefImpl.java:114— `len` is read from the bytes being parsed at line 113 (`readInt`), then used to size a `new byte[]` at line 114 — and nowhere in its scope is `len` bounded from above — compared to a limit, clamped, or checked against the input that remains (a zero or sign test, or the loop that counts up to it, bounds nothing). Whoever wrote those bytes therefore chooses the allocation directly: a 32-bit length asks for up to 2 GiB before a single byte of the payload is known to exist, which either exhausts the heap with an `OutOfMemoryError` or, negative, throws `NegativeArraySizeException` out of a parser whose failure path was written for malformed input, not for hostile input. Bound `len` against the bytes actually remaining and a maximum the format allows before allocating.
No assertions: opens a new Ray dashboard python/ray/dashboard/tests/cypress/e2e/test_render.cy.js:2— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: renders HEALTHY status python/ray/dashboard/client/src/common/ServeStatus.component.test.tsx:16— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: renders UNHEALTHY status python/ray/dashboard/client/src/common/ServeStatus.component.test.tsx:24— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: renders UPDATING status python/ray/dashboard/client/src/common/ServeStatus.component.test.tsx:36— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
XxxComment release/llm_tests/serve/probes/test_basic.py:162— # XXX: AE-686 hack, should read model data instead
XxxComment python/ray/serve/tests/test_metrics_2.py:382— # {xxx, route:/api}, {xxx, route:/api2} — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment python/ray/serve/tests/test_metrics_2.py:384— # {xxx, route:/api} — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment python/ray/serve/tests/test_metrics_2.py:386— # {xxx, route:/api2} — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
Duplicated block (27 lines × 2) doc/source/serve/doc_code/intel_gaudi_inference_serve.py:96— doc/source/serve/doc_code/intel_gaudi_inference_serve.py:96-122 | doc/source/serve/doc_code/intel_gaudi_inference_serve_deepspeed.py:234-260 — 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 (27 lines × 2) python/ray/rllib/offline/offline_evaluation_runner.py:70— python/ray/rllib/offline/offline_evaluation_runner.py:70-96 | python/ray/rllib/offline/offline_policy_evaluation_runner.py:273-299 — before extracting anything, compare `python/ray/rllib/offline/offline_evaluation_runner.py` and `python/ray/rllib/offline/offline_policy_evaluation_runner.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 119 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 (27 lines × 2) python/ray/rllib/policy/torch_policy.py:1057— python/ray/rllib/policy/torch_policy.py:1057-1083 | python/ray/rllib/policy/torch_policy_v2.py:1142-1168 — before extracting anything, compare `python/ray/rllib/policy/torch_policy.py` and `python/ray/rllib/policy/torch_policy_v2.py` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 513 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 `python/ray/rllib/policy/torch_policy.py:1057` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (27 lines × 2) python/ray/rllib/utils/replay_buffers/multi_agent_episode_buffer.py:651— python/ray/rllib/utils/replay_buffers/multi_agent_episode_buffer.py:651-677 | python/ray/rllib/utils/replay_buffers/multi_agent_prioritized_episode_buffer.py:848-874 — before extracting anything, compare `python/ray/rllib/utils/replay_buffers/multi_agent_episode_buffer.py` and `python/ray/rllib/utils/replay_buffers/multi_agent_prioritized_episode_buffer.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 417 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (26 lines × 2) python/ray/dashboard/modules/aggregator/publisher/async_publisher_client.py:218— python/ray/dashboard/modules/aggregator/publisher/async_publisher_client.py:218-243 | python/ray/dashboard/modules/aggregator/publisher/async_publisher_client.py:348-373 — both copies are in the same file, so extract the 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 (26 lines × 2) REDACTED:1346— REDACTED:1346-1371 | REDACTED:1536-1561 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (26 lines × 2) python/ray/data/_internal/planner/checkpoint/plan_write_op.py:203— python/ray/data/_internal/planner/checkpoint/plan_write_op.py:203-228 | python/ray/data/_internal/planner/checkpoint/plan_write_op.py:312-340 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (26 lines × 2) release/nightly_tests/dataset/benchmark.py:29— release/nightly_tests/dataset/benchmark.py:29-54 | release/nightly_tests/multimodal_inference_benchmarks/benchmark.py:29-54 — `release/nightly_tests/dataset/benchmark.py` and `release/nightly_tests/multimodal_inference_benchmarks/benchmark.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 9 separate duplicated blocks between them, totalling at least 302 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 (25 lines × 2) python/ray/air/util/data_batch_conversion.py:56— python/ray/air/util/data_batch_conversion.py:56-80 | python/ray/data/util/data_batch_conversion.py:62-86 — before extracting anything, compare `python/ray/air/util/data_batch_conversion.py` and `python/ray/data/util/data_batch_conversion.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 113 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Note first that the copies are not typed on the same thing: `TENSOR_COLUMN_NAME` names `ray.air.constants` in one and `ray.data.constants` 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 (25 lines × 2) python/ray/rllib/core/models/torch/encoder.py:52— python/ray/rllib/core/models/torch/encoder.py:52-76 | python/ray/rllib/core/models/torch/heads.py:22-46 — 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 `config` to `MLPEncoderConfig` in one and `MLPHeadConfig` 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 (25 lines × 2) python/ray/util/collective/collective.py:592— python/ray/util/collective/collective.py:592-616 | python/ray/util/collective/collective.py:649-673 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (25 lines × 2) release/nightly_tests/dataset/gpu_batch_inference.py:21— release/nightly_tests/dataset/gpu_batch_inference.py:21-45 | release/nightly_tests/dataset/image_classification_from_parquet/main.py:24-48 — before extracting anything, compare `release/nightly_tests/dataset/gpu_batch_inference.py` and `release/nightly_tests/dataset/image_classification_from_parquet/main.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 115 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 (17–18 lines × 2) python/ray/autoscaler/sdk/sdk.py:296— python/ray/autoscaler/sdk/sdk.py:296-312 | python/ray/util/placement_group.py:530-547 — 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 (17–18 lines × 2) python/ray/rllib/models/tf/recurrent_net.py:232— python/ray/rllib/models/tf/recurrent_net.py:232-249 | python/ray/rllib/models/torch/recurrent_net.py:218-234 — `python/ray/rllib/models/tf/recurrent_net.py` and `python/ray/rllib/models/torch/recurrent_net.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 3 separate duplicated blocks between them, totalling at least 51 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 `python/ray/rllib/models/tf/recurrent_net.py:232` 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 (17–18 lines × 2) python/ray/rllib/utils/replay_buffers/multi_agent_prioritized_episode_buffer.py:440— python/ray/rllib/utils/replay_buffers/multi_agent_prioritized_episode_buffer.py:440-457 | python/ray/rllib/utils/replay_buffers/prioritized_episode_buffer.py:342-358 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (17–18 lines × 2) python/ray/train/v2/_internal/execution/context.py:501— python/ray/train/v2/_internal/execution/context.py:501-517 | python/ray/train/v2/_internal/execution/context.py:576-593 — both copies are in the same file, so extract the 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–17 lines × 2) python/ray/rllib/offline/offline_prelearner.py:405— python/ray/rllib/offline/offline_prelearner.py:405-420 | python/ray/rllib/offline/offline_prelearner.py:555-571 — both copies are in the same file, so extract the 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 `python/ray/rllib/offline/offline_prelearner.py:405` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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–17 lines × 2) python/ray/rllib/policy/torch_policy.py:1027— python/ray/rllib/policy/torch_policy.py:1027-1043 | python/ray/rllib/policy/torch_policy_v2.py:1114-1129 — before extracting anything, compare `python/ray/rllib/policy/torch_policy.py` and `python/ray/rllib/policy/torch_policy_v2.py` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 513 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 (16–17 lines × 2) python/ray/rllib/utils/exploration/gaussian_noise.py:188— python/ray/rllib/utils/exploration/gaussian_noise.py:188-203 | python/ray/rllib/utils/exploration/ornstein_uhlenbeck_noise.py:183-199 — before extracting anything, compare `python/ray/rllib/utils/exploration/gaussian_noise.py` and `python/ray/rllib/utils/exploration/ornstein_uhlenbeck_noise.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 58 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `python/ray/rllib/utils/exploration/gaussian_noise.py:188` 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) python/ray/tune/examples/mlflow_ptl.py:69— python/ray/tune/examples/mlflow_ptl.py:69-85 | python/ray/tune/examples/mnist_ptl_mini.py:136-151 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `python/ray/tune/examples/mlflow_ptl.py:69` it begins part-way through the construct above it, so those 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) python/ray/rllib/core/learner/learner.py:1021— python/ray/rllib/core/learner/learner.py:1021-1033 | python/ray/rllib/core/learner/torch/torch_meta_learner.py:380-392 | python/ray/rllib/offline/offline_evaluation_runner.py:252-264 — before extracting anything, compare `python/ray/rllib/core/learner/learner.py` and `python/ray/rllib/core/learner/torch/torch_meta_learner.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 171 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 `python/ray/rllib/core/learner/learner.py:1021` 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) python/ray/_private/accelerators/amd_gpu.py:54— python/ray/_private/accelerators/amd_gpu.py:54-67 | python/ray/_private/accelerators/npu.py:30-43 | python/ray/_private/accelerators/nvidia_gpu.py:38-50 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. 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) release/nightly_tests/dataset/image_embedding_from_jsonl/main.py:291— release/nightly_tests/dataset/image_embedding_from_jsonl/main.py:291-303 | release/nightly_tests/dataset/image_embedding_from_uris/main.py:245-257 | release/nightly_tests/dataset/text_embedding/main.py:119-131 — 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 (13 lines × 3) python/ray/tune/examples/async_hyperband_example.py:13— python/ray/tune/examples/async_hyperband_example.py:13-25 | python/ray/tune/examples/logging_example.py:12-32 | python/ray/tune/examples/tune_basic_example.py:9-21 — 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 (12–13 lines × 2) doc/source/serve/tutorials/video-analysis/scripts/download_stock_videos.py:484— doc/source/serve/tutorials/video-analysis/scripts/download_stock_videos.py:484-495 | doc/source/serve/tutorials/video-analysis/scripts/download_stock_videos.py:503-515 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `doc/source/serve/tutorials/video-analysis/scripts/download_stock_videos.py:484` it begins part-way through the construct above it, so those 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 × 2) python/ray/experimental/channel/shared_memory_channel.py:456— python/ray/experimental/channel/shared_memory_channel.py:456-467 | python/ray/experimental/channel/torch_tensor_accelerator_channel.py:188-200 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (12–13 lines × 2) python/ray/llm/_internal/batch/processor/__init__.py:53— python/ray/llm/_internal/batch/processor/__init__.py:53-64 | python/ray/llm/_internal/batch/stages/__init__.py:45-57 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (12–13 lines × 2) python/ray/rllib/core/distribution/torch/torch_distribution.py:624— python/ray/rllib/core/distribution/torch/torch_distribution.py:624-635 | python/ray/rllib/models/torch/torch_action_dist.py:545-557 — 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 `python/ray/rllib/core/distribution/torch/torch_distribution.py:624` it begins part-way through the construct above it, so those 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 × 3) python/ray/autoscaler/_private/commands.py:537— python/ray/autoscaler/_private/commands.py:537-548 | python/ray/autoscaler/_private/commands.py:636-647 | python/ray/autoscaler/_private/commands.py:1269-1280 — 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 `python/ray/autoscaler/_private/commands.py:537` 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 × 3) doc/source/train/doc_code/fault_tolerance.py:25— doc/source/train/doc_code/fault_tolerance.py:25-37 | doc/source/train/doc_code/fault_tolerance.py:149-161 | doc/source/train/doc_code/train_tune_interop.py:162-173 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `doc/source/train/doc_code/train_tune_interop.py:176` calls `train_fn_driver` and `doc/source/train/doc_code/fault_tolerance.py:40` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (12 lines × 3) python/ray/llm/_internal/common/models.py:38— python/ray/llm/_internal/common/models.py:38-49 | python/ray/llm/_internal/serve/utils/server_utils.py:110-121 | release/llm_tests/serve/probes/util.py:9-20 — before extracting anything, compare `python/ray/llm/_internal/common/models.py` and `release/llm_tests/serve/probes/util.py` as WHOLE FILES: 92% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (12 lines × 3) java/runtime/src/main/java/io/ray/runtime/util/generator/RayCallGenerator.java:18— java/runtime/src/main/java/io/ray/runtime/util/generator/RayCallGenerator.java:18-29 | java/runtime/src/main/java/io/ray/runtime/util/generator/RayCallGenerator.java:113-124 | java/runtime/src/main/java/io/ray/runtime/util/generator/RayCallGenerator.java:136-147 — 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 × 4) doc/source/tune/doc_code/pytorch_optuna.py:36— doc/source/tune/doc_code/pytorch_optuna.py:36-40 | python/ray/tune/examples/cifar10_pytorch.py:161-166 | python/ray/tune/examples/cifar10_pytorch.py:215-219 | python/ray/tune/examples/mnist_pytorch.py:61-65 — before extracting anything, compare `doc/source/tune/doc_code/pytorch_optuna.py` and `python/ray/tune/examples/mnist_pytorch.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 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 (5 lines × 4) python/ray/data/preprocessors/encoder.py:337— python/ray/data/preprocessors/encoder.py:337-341 | python/ray/data/preprocessors/encoder.py:631-635 | python/ray/data/preprocessors/encoder.py:827-831 | python/ray/data/preprocessors/hasher.py:150-154 — 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 (5 lines × 4) REDACTED:29— REDACTED:29-33 | java/api/src/main/java/io/ray/api/id/JobId.java:50-54 | java/api/src/main/java/io/ray/api/id/TaskId.java:32-36 | REDACTED:30-34 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `java/api/src/main/java/io/ray/api/id/TaskId.java:38` calls `TaskId`, `super` and `java/api/src/main/java/io/ray/api/id/JobId.java:56` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5 lines × 4) release/nightly_tests/dataset/tpch/tpch_q20.py:52— release/nightly_tests/dataset/tpch/tpch_q20.py:52-56 | release/nightly_tests/dataset/tpch/tpch_q5.py:38-45 | release/nightly_tests/dataset/tpch/tpch_q8.py:52-59 | release/nightly_tests/dataset/tpch/tpch_q9.py:39-45 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `release/nightly_tests/dataset/tpch/tpch_q20.py:52` 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, `release/nightly_tests/dataset/tpch/tpch_q8.py:50` calls `load_table`, `select_columns` and `release/nightly_tests/dataset/tpch/tpch_q5.py:37` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (16 lines × 2 locations) python/ray/dashboard/client/src/common/ServeStatus.tsx:21— python/ray/dashboard/client/src/common/ServeStatus.tsx:21 · python/ray/dashboard/client/src/common/ServeStatus.tsx:37 — 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 (16 lines × 2 locations) python/ray/dashboard/client/src/components/LogView/LogVirtualView.tsx:124— python/ray/dashboard/client/src/components/LogView/LogVirtualView.tsx:124 · python/ray/dashboard/client/src/components/LogView/LogVirtualView.tsx:159 — all 2 copies are in the same file, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
Duplicated block (16 lines × 2 locations) python/ray/dashboard/client/src/pages/overview/cards/ClusterUtilizationCard.tsx:15— python/ray/dashboard/client/src/pages/overview/cards/ClusterUtilizationCard.tsx:15 · python/ray/dashboard/client/src/pages/overview/cards/NodeCountCard.tsx:17 — the 2 copies are spread across 2 files, 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 × 2 locations) python/ray/dashboard/client/src/pages/serve/ServeSystemDetailRows.tsx:88— python/ray/dashboard/client/src/pages/serve/ServeSystemDetailRows.tsx:88 · python/ray/dashboard/client/src/pages/serve/ServeSystemDetailRows.tsx:110 — 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 (33 lines × 2) python/ray/rllib/core/learner/learner.py:998— python/ray/rllib/core/learner/learner.py:998-1030 | python/ray/rllib/core/learner/torch/torch_meta_learner.py:353-389 — before extracting anything, compare `python/ray/rllib/core/learner/learner.py` and `python/ray/rllib/core/learner/torch/torch_meta_learner.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 171 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 `python/ray/rllib/core/learner/learner.py:998` 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 (33 lines × 2) python/ray/rllib/offline/estimators/importance_sampling.py:81— python/ray/rllib/offline/estimators/importance_sampling.py:81-113 | python/ray/rllib/offline/estimators/weighted_importance_sampling.py:137-169 — 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 `python/ray/rllib/offline/estimators/importance_sampling.py:81` 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 (33 lines × 2) python/ray/rllib/offline/offline_evaluation_runner.py:380— python/ray/rllib/offline/offline_evaluation_runner.py:380-412 | python/ray/rllib/offline/offline_policy_evaluation_runner.py:595-627 — before extracting anything, compare `python/ray/rllib/offline/offline_evaluation_runner.py` and `python/ray/rllib/offline/offline_policy_evaluation_runner.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 119 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (30 lines × 2) python/ray/rllib/core/learner/torch/torch_differentiable_learner.py:43— python/ray/rllib/core/learner/torch/torch_differentiable_learner.py:43-72 | python/ray/rllib/core/learner/torch/torch_learner.py:72-101 — 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 (30 lines × 2) python/ray/train/_internal/storage.py:202— python/ray/train/_internal/storage.py:202-231 | python/ray/train/v2/_internal/execution/storage.py:197-226 — before extracting anything, compare `python/ray/train/_internal/storage.py` and `python/ray/train/v2/_internal/execution/storage.py` as WHOLE FILES: this scan already matched 8 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. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (30 lines × 2) python/ray/rllib/core/learner/differentiable_learner.py:711— python/ray/rllib/core/learner/differentiable_learner.py:711-740 | python/ray/rllib/core/learner/learner.py:1830-1859 — before extracting anything, compare `python/ray/rllib/core/learner/differentiable_learner.py` and `python/ray/rllib/core/learner/learner.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 141 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 (20–22 lines × 2) python/ray/_private/runtime_env/validation.py:221— python/ray/_private/runtime_env/validation.py:221-240 | python/ray/_private/runtime_env/validation.py:329-350 — both copies are in the same file, so extract the 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–22 lines × 2) python/ray/rllib/algorithms/dreamerv3/torch/models/actor_network.py:91— python/ray/rllib/algorithms/dreamerv3/torch/models/actor_network.py:91-112 | python/ray/rllib/algorithms/dreamerv3/torch/models/components/vector_decoder.py:51-70 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. 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–22 lines × 2) python/ray/rllib/offline/estimators/direct_method.py:158— python/ray/rllib/offline/estimators/direct_method.py:158-179 | python/ray/rllib/offline/estimators/importance_sampling.py:106-125 — 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 `python/ray/rllib/offline/estimators/direct_method.py:158` it begins part-way through the construct above it, so those 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) python/ray/data/_internal/tensor_extensions/arrow.py:1059— python/ray/data/_internal/tensor_extensions/arrow.py:1059-1076 | python/ray/data/_internal/tensor_extensions/arrow.py:1835-1853 — both copies are in the same file, so extract the 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 `python/ray/data/_internal/tensor_extensions/arrow.py:1059` 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 (18–19 lines × 2) python/ray/rllib/utils/exploration/epsilon_greedy.py:143— python/ray/rllib/utils/exploration/epsilon_greedy.py:143-161 | python/ray/rllib/utils/exploration/slate_epsilon_greedy.py:47-64 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `python/ray/rllib/utils/exploration/epsilon_greedy.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 (18–19 lines × 2) release/air_tests/air_benchmarks/workloads/tensorflow_benchmark.py:169— release/air_tests/air_benchmarks/workloads/tensorflow_benchmark.py:169-186 | release/air_tests/air_benchmarks/workloads/torch_benchmark.py:307-325 — before extracting anything, compare `release/air_tests/air_benchmarks/workloads/tensorflow_benchmark.py` and `release/air_tests/air_benchmarks/workloads/torch_benchmark.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 155 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 `release/air_tests/air_benchmarks/workloads/tensorflow_benchmark.py:169` it begins part-way through the construct above it, so those 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–17 lines × 2) python/ray/_private/utils.py:1276— python/ray/_private/utils.py:1276-1292 | python/ray/_private/utils.py:1298-1312 — both copies are in the same file, so extract the 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–17 lines × 2) python/ray/serve/_private/common.py:387— python/ray/serve/_private/common.py:387-403 | python/ray/serve/_private/common.py:553-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 `python/ray/serve/_private/common.py:387` it begins part-way through the construct above it, so those 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–17 lines × 2) python/ray/util/iter.py:445— python/ray/util/iter.py:445-461 | python/ray/util/iter.py:603-617 — both copies are in the same file, so extract the 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 `python/ray/util/iter.py:445` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14–16 lines × 2) python/ray/data/_internal/logical/rules/operator_fusion.py:481— python/ray/data/_internal/logical/rules/operator_fusion.py:481-494 | python/ray/data/_internal/logical/rules/operator_fusion.py:619-634 — both copies are in the same file, so extract the 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 `down_op` to `PhysicalOperator` in one and `MapOperator` 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–16 lines × 2) python/ray/rllib/algorithms/cql/cql_tf_policy.py:248— python/ray/rllib/algorithms/cql/cql_tf_policy.py:248-261 | python/ray/rllib/algorithms/cql/cql_torch_policy.py:255-270 — 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 `python/ray/rllib/algorithms/cql/cql_torch_policy.py: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 (14–16 lines × 2) python/ray/rllib/models/tf/attention_net.py:482— python/ray/rllib/models/tf/attention_net.py:482-495 | python/ray/rllib/models/torch/attention_net.py:354-369 — `python/ray/rllib/models/tf/attention_net.py` and `python/ray/rllib/models/torch/attention_net.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 5 separate duplicated blocks between them, totalling at least 114 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `python/ray/rllib/models/torch/attention_net.py:354` it begins part-way through the construct above it, so those 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 × 2) python/ray/rllib/evaluation/collectors/simple_list_collector.py:511— python/ray/rllib/evaluation/collectors/simple_list_collector.py:511-525 | python/ray/rllib/evaluation/sample_batch_builder.py:199-214 — 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 `python/ray/rllib/evaluation/sample_batch_builder.py:199` it begins part-way through the construct above it, so those 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 × 2) release/nightly_tests/dataset/iceberg_benchmark.py:86— release/nightly_tests/dataset/iceberg_benchmark.py:86-100 | release/nightly_tests/dataset/iceberg_benchmark.py:105-120 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `release/nightly_tests/dataset/iceberg_benchmark.py:86` it begins part-way through the construct above it, so those 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 × 2) release/nightly_tests/dataset/tpch/tpch_q10.py:69— release/nightly_tests/dataset/tpch/tpch_q10.py:69-84 | release/nightly_tests/dataset/tpch/tpch_q16.py:58-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 both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `release/nightly_tests/dataset/tpch/tpch_q16.py:58` 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 (14–15 lines × 2) ci/raydepsets/cli.py:183— ci/raydepsets/cli.py:183-197 | ci/raydepsets/cli.py:214-227 — both copies are in the same file, so extract the 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 `ci/raydepsets/cli.py:183` it begins part-way through the construct above it, so those 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, `ci/raydepsets/cli.py:213` calls `add_edge` and `ci/raydepsets/cli.py:183` 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 (14–15 lines × 2) python/ray/dashboard/state_aggregator.py:119— python/ray/dashboard/state_aggregator.py:119-133 | python/ray/dashboard/state_aggregator.py:273-286 — both copies are in the same file, so extract the 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–15 lines × 2) python/ray/tune/examples/hyperopt_conditional_search_space_example.py:80— python/ray/tune/examples/hyperopt_conditional_search_space_example.py:80-93 | python/ray/tune/examples/optuna_define_by_run_example.py:65-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.
Duplicated block (13–15 lines × 2) python/ray/dashboard/state_aggregator.py:428— python/ray/dashboard/state_aggregator.py:428-442 | python/ray/dashboard/state_aggregator.py:550-562 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `python/ray/dashboard/state_aggregator.py:428` it begins part-way through the construct above it, so those 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–15 lines × 2) python/ray/rllib/utils/replay_buffers/multi_agent_episode_buffer.py:316— python/ray/rllib/utils/replay_buffers/multi_agent_episode_buffer.py:316-328 | python/ray/rllib/utils/replay_buffers/multi_agent_prioritized_episode_buffer.py:411-425 — before extracting anything, compare `python/ray/rllib/utils/replay_buffers/multi_agent_episode_buffer.py` and `python/ray/rllib/utils/replay_buffers/multi_agent_prioritized_episode_buffer.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 417 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 `python/ray/rllib/utils/replay_buffers/multi_agent_prioritized_episode_buffer.py:411` 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 (13–15 lines × 2) python/ray/train/lightgbm/_lightgbm_utils.py:107— python/ray/train/lightgbm/_lightgbm_utils.py:107-119 | python/ray/train/xgboost/_xgboost_utils.py:83-97 — 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 (11 lines × 3) REDACTED:417— REDACTED:417-427 | REDACTED:579-589 | REDACTED:743-753 — 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) python/ray/rllib/utils/replay_buffers/multi_agent_episode_buffer.py:298— python/ray/rllib/utils/replay_buffers/multi_agent_episode_buffer.py:298-308 | python/ray/rllib/utils/replay_buffers/multi_agent_prioritized_episode_buffer.py:391-401 | python/ray/rllib/utils/replay_buffers/prioritized_episode_buffer.py:302-312 — before extracting anything, compare `python/ray/rllib/utils/replay_buffers/multi_agent_episode_buffer.py` and `python/ray/rllib/utils/replay_buffers/multi_agent_prioritized_episode_buffer.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 417 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 `python/ray/rllib/utils/replay_buffers/multi_agent_episode_buffer.py:298` 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, `python/ray/rllib/utils/replay_buffers/multi_agent_prioritized_episode_buffer.py:403` calls `_get_free_node_and_assign` and `python/ray/rllib/utils/replay_buffers/multi_agent_episode_buffer.py:309` 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 (11 lines × 3) python/ray/rllib/algorithms/impala/impala.py:501— python/ray/rllib/algorithms/impala/impala.py:501-511 | python/ray/rllib/algorithms/marwil/marwil.py:272-282 | python/ray/rllib/algorithms/ppo/ppo.py:159-169 — 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 (9–11 lines × 2) python/ray/rllib/algorithms/dreamerv3/torch/models/dreamer_model.py:292— python/ray/rllib/algorithms/dreamerv3/torch/models/dreamer_model.py:292-300 | python/ray/rllib/algorithms/dreamerv3/torch/models/dreamer_model.py:511-521 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9–11 lines × 2) python/ray/train/v2/_internal/execution/worker_group/worker_group.py:454— python/ray/train/v2/_internal/execution/worker_group/worker_group.py:454-464 | python/ray/train/v2/_internal/execution/worker_group/worker_group.py:1015-1023 — both copies are in the same file, so extract the 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 `python/ray/train/v2/_internal/execution/worker_group/worker_group.py:454` it begins part-way through the construct above it, so those 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, `python/ray/train/v2/_internal/execution/worker_group/worker_group.py:1010` calls `WorkerGroupStartupFailedError`, `start_training`, `join` and `python/ray/train/v2/_internal/execution/worker_group/worker_group.py:454` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9–11 lines × 2) python/ray/tune/schedulers/hyperband.py:287— python/ray/tune/schedulers/hyperband.py:287-295 | python/ray/tune/schedulers/hyperband.py:329-339 — both copies are in the same file, so extract the 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 × 3) python/ray/rllib/algorithms/cql/torch/cql_torch_learner.py:252— python/ray/rllib/algorithms/cql/torch/cql_torch_learner.py:252-262 | python/ray/rllib/algorithms/iql/torch/iql_torch_learner.py:209-218 | python/ray/rllib/algorithms/sac/torch/sac_torch_learner.py:406-415 — before extracting anything, compare `python/ray/rllib/algorithms/iql/torch/iql_torch_learner.py` and `python/ray/rllib/algorithms/sac/torch/sac_torch_learner.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 90 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 `python/ray/rllib/algorithms/cql/torch/cql_torch_learner.py: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 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: `ALL_MODULES` names `ray.rllib.core` in one and `ray.rllib.utils.metrics` 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 (10 lines × 3) python/ray/rllib/core/learner/torch/torch_differentiable_learner.py:320— python/ray/rllib/core/learner/torch/torch_differentiable_learner.py:320-329 | python/ray/rllib/offline/offline_evaluation_runner.py:237-246 | python/ray/rllib/offline/offline_policy_evaluation_runner.py:452-461 — before extracting anything, compare `python/ray/rllib/offline/offline_evaluation_runner.py` and `python/ray/rllib/offline/offline_policy_evaluation_runner.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 119 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (10 lines × 3) python/ray/_private/accelerators/hpu.py:40— python/ray/_private/accelerators/hpu.py:40-50 | python/ray/_private/accelerators/metax_gpu.py:26-35 | python/ray/_private/accelerators/neuron.py:45-55 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9–10 lines × 2) docker/retag-lambda/lambda_function.py:65— docker/retag-lambda/lambda_function.py:65-73 | docker/retag-lambda/lambda_function.py:82-91 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9–10 lines × 2) python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_map_operator.py:94— python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_map_operator.py:94-102 | python/ray/data/_internal/execution/operators/shuffle_operators/shuffle_map_operator.py:118-127 — before extracting anything, compare `python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_map_operator.py` and `python/ray/data/_internal/execution/operators/shuffle_operators/shuffle_map_operator.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 102 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 `python/ray/data/_internal/execution/operators/shuffle_operators/shuffle_map_operator.py:118` it begins part-way through the construct above it, so those 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) python/ray/data/_internal/logical/rules/operator_fusion.py:452— python/ray/data/_internal/logical/rules/operator_fusion.py:452-460 | python/ray/data/_internal/logical/rules/operator_fusion.py:597-606 — both copies are in the same file, so extract the 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 `down_op` to `PhysicalOperator` in one and `MapOperator` 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 (9 lines × 3) REDACTED:872— REDACTED:872-880 | python/ray/experimental/channel/shared_memory_channel.py:458-468 | python/ray/experimental/channel/torch_tensor_accelerator_channel.py:193-201 — 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 `python/ray/experimental/channel/shared_memory_channel.py:458` it begins part-way through the construct above it, so those 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 × 3) python/ray/rllib/algorithms/dqn/dqn_torch_policy.py:302— python/ray/rllib/algorithms/dqn/dqn_torch_policy.py:302-310 | python/ray/rllib/algorithms/dqn/dqn_torch_policy.py:329-339 | python/ray/rllib/algorithms/dqn/dqn_torch_policy.py:343-353 — 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 `python/ray/rllib/algorithms/dqn/dqn_torch_policy.py:302` it begins part-way through the construct above it, so those 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 × 3) python/ray/_private/accelerators/hpu.py:103— python/ray/_private/accelerators/hpu.py:103-111 | python/ray/_private/accelerators/neuron.py:89-97 | python/ray/_private/accelerators/rbln.py:62-70 — 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 (8 lines × 3) REDACTED:378— REDACTED:378-385 | REDACTED:540-547 | REDACTED:704-711 — 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 (8 lines × 3) python/ray/tune/search/ax/ax_search.py:179— python/ray/tune/search/ax/ax_search.py:179-187 | python/ray/tune/search/bohb/bohb_search.py:148-156 | python/ray/tune/search/hyperopt/hyperopt_search.py:190-197 — 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 (8 lines × 3) python/ray/serve/_private/config.py:280— python/ray/serve/_private/config.py:280-288 | python/ray/serve/config.py:280-290 | python/ray/serve/config.py:448-455 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (15 lines × 3) python/ray/data/_internal/issue_detection/detectors/hanging_detector.py:110— python/ray/data/_internal/issue_detection/detectors/hanging_detector.py:110-124 | python/ray/data/_internal/issue_detection/detectors/hash_shuffle_detector.py:50-64 | python/ray/data/_internal/issue_detection/detectors/high_memory_detector.py:71-85 — 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 after the matched lines, `python/ray/data/_internal/issue_detection/detectors/hash_shuffle_detector.py:68` calls `time` and `python/ray/data/_internal/issue_detection/detectors/high_memory_detector.py:89` 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 × 3) java/api/src/main/java/io/ray/api/call/CppTaskCaller.java:16— java/api/src/main/java/io/ray/api/call/CppTaskCaller.java:16-30 | java/api/src/main/java/io/ray/api/call/PyTaskCaller.java:16-30 | java/api/src/main/java/io/ray/api/call/TaskCaller.java:16-30 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Note first that the copies are not typed on the same thing: the declarations holding them bind `func` to `CppFunction<R>` in one and `PyFunction<R>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (15 lines × 3) python/ray/tune/examples/pbt_tune_cifar10_with_keras.py:58— python/ray/tune/examples/pbt_tune_cifar10_with_keras.py:58-72 | python/ray/tune/examples/pbt_tune_cifar10_with_keras.py:76-90 | python/ray/tune/examples/pbt_tune_cifar10_with_keras.py:94-108 — 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 `python/ray/tune/examples/pbt_tune_cifar10_with_keras.py:58` 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) python/ray/rllib/examples/_old_api_stack/models/shared_weights_model.py:43— python/ray/rllib/examples/_old_api_stack/models/shared_weights_model.py:43-49 | python/ray/rllib/examples/_old_api_stack/models/shared_weights_model.py:89-95 | python/ray/rllib/examples/_old_api_stack/models/shared_weights_model.py:128-134 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 3) python/ray/rllib/examples/rl_modules/classes/intrinsic_curiosity_model_rlm.py:103— python/ray/rllib/examples/rl_modules/classes/intrinsic_curiosity_model_rlm.py:103-109 | python/ray/rllib/examples/rl_modules/classes/intrinsic_curiosity_model_rlm.py:119-125 | python/ray/rllib/examples/rl_modules/classes/intrinsic_curiosity_model_rlm.py:136-142 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 3) python/ray/train/examples/pytorch/torch_quick_start.py:23— python/ray/train/examples/pytorch/torch_quick_start.py:23-29 | release/air_tests/air_benchmarks/workloads/torch_benchmark.py:26-32 | REDACTED:13-19 — 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 `python/ray/train/examples/pytorch/torch_quick_start.py:23` 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, `release/air_tests/air_benchmarks/workloads/torch_benchmark.py:33` calls `ReLU` and `python/ray/train/examples/pytorch/torch_quick_start.py:30` 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 lines × 2 locations) python/ray/dashboard/client/src/common/ProfilingLink.tsx:522— python/ray/dashboard/client/src/common/ProfilingLink.tsx:522 · python/ray/dashboard/client/src/common/ProfilingLink.tsx:557 — 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 (21 lines × 2 locations) python/ray/dashboard/client/src/pages/job/JobTaskNameProgressTable/JobTaskNameProgressTable.tsx:41— python/ray/dashboard/client/src/pages/job/JobTaskNameProgressTable/JobTaskNameProgressTable.tsx:41 · python/ray/dashboard/client/src/pages/job/index.tsx:148 — the 2 copies are spread across 2 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
Duplicated block (21 lines × 2 locations) python/ray/dashboard/client/src/pages/serve/ServeDeploymentMetricsSection.tsx:176— python/ray/dashboard/client/src/pages/serve/ServeDeploymentMetricsSection.tsx:176 · python/ray/dashboard/client/src/pages/serve/ServeMetricsSection.tsx:193 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
Duplicated block (15 lines × 2 locations) python/ray/dashboard/client/src/components/ActorTable.tsx:370— python/ray/dashboard/client/src/components/ActorTable.tsx:370 · python/ray/dashboard/client/src/components/ActorTable.tsx:386 — 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 (15 lines × 2 locations) python/ray/dashboard/client/src/pages/job/JobDetail.tsx:214— python/ray/dashboard/client/src/pages/job/JobDetail.tsx:214 · python/ray/dashboard/client/src/pages/job/JobDetail.tsx:231 — all 2 copies are in the same file, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
Duplicated block (15 lines × 2 locations) python/ray/dashboard/client/src/pages/job/index.tsx:116— python/ray/dashboard/client/src/pages/job/index.tsx:116 · python/ray/dashboard/client/src/pages/serve/ServeDeploymentsListPage.tsx:87 — the 2 copies are spread across 2 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
config._configure_key_pair (cyclomatic 16) python/ray/autoscaler/_private/aws/config.py:354— config._configure_key_pair 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.
config._configure_key_pair (cyclomatic 16) python/ray/autoscaler/_private/gcp/config.py:482— config._configure_key_pair 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.
ComplexInputNetwork.__init__ (cognitive 16) python/ray/rllib/models/tf/complex_input_net.py:35— ComplexInputNetwork.__init__ has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 3 (5 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.
ComplexInputNetwork.__init__ (cognitive 16) python/ray/rllib/models/torch/complex_input_net.py:37— ComplexInputNetwork.__init__ has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 3 (5 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.
ClassTooLong: ActorTable python/ray/dashboard/client/src/components/ActorTable.tsx:1— ClassTooLong — 631 significant lines (blank, comment-only and punctuation-only lines excluded), 2 methods. The bar is 400 significant lines; this is 231 over it, 1.58× 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: LocalModeTaskSubmitter REDACTED:56— ClassTooLong — 413 significant lines (blank, comment-only and punctuation-only lines excluded), 24 methods. The bar is 400 significant lines; this is 13 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.
D4 · Code Duplication· Members sharing a duplicated core (8 members, 50+ identical tokens) · ×2
Members sharing a duplicated core (8 members, 50+ identical tokens) python/ray/dashboard/dashboard.py:85— python/ray/dashboard/dashboard.py:85-104 | python/ray/rllib/utils/replay_buffers/episode_replay_buffer.py:822-1072 | python/ray/rllib/utils/replay_buffers/multi_agent_episode_buffer.py:645-855 | python/ray/rllib/utils/replay_buffers/multi_agent_prioritized_episode_buffer.py:831-1092 | python/ray/rllib/utils/replay_buffers/prioritized_episode_buffer.py:375-621 | python/ray/serve/api.py:576-804 | python/ray/tune/tune.py:316-1065 | REDACTED:820-1229 — These 8 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 8 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 8 times.
Members sharing a duplicated core (8 members, 50+ identical tokens) python/ray/tune/search/ax/ax_search.py:324— python/ray/tune/search/ax/ax_search.py:324-358 | REDACTED:274-356 | python/ray/tune/search/bohb/bohb_search.py:215-242 | REDACTED:268-302 | REDACTED:265-290 | REDACTED:496-525 | REDACTED:583-631 | REDACTED:271-297 — These 8 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 8 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 8 times.
Duplicated block (45 lines × 2) python/ray/rllib/utils/replay_buffers/multi_agent_episode_buffer.py:805— python/ray/rllib/utils/replay_buffers/multi_agent_episode_buffer.py:805-849 | python/ray/rllib/utils/replay_buffers/multi_agent_prioritized_episode_buffer.py:1042-1086 — before extracting anything, compare `python/ray/rllib/utils/replay_buffers/multi_agent_episode_buffer.py` and `python/ray/rllib/utils/replay_buffers/multi_agent_prioritized_episode_buffer.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 417 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 `python/ray/rllib/utils/replay_buffers/multi_agent_prioritized_episode_buffer.py:1042` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (45 lines × 2) python/ray/train/_internal/storage.py:149— python/ray/train/_internal/storage.py:149-193 | python/ray/train/v2/_internal/execution/storage.py:144-188 — before extracting anything, compare `python/ray/train/_internal/storage.py` and `python/ray/train/v2/_internal/execution/storage.py` as WHOLE FILES: this scan already matched 8 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. 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 (43 lines × 2) python/ray/rllib/algorithms/algorithm_config.py:1059— python/ray/rllib/algorithms/algorithm_config.py:1059-1101 | python/ray/rllib/algorithms/algorithm_config.py:1167-1209 — both copies are in the same file, so extract the 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 `python/ray/rllib/algorithms/algorithm_config.py:1059` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (43 lines × 2) release/nightly_tests/dataset/benchmark.py:60— release/nightly_tests/dataset/benchmark.py:60-102 | release/nightly_tests/multimodal_inference_benchmarks/benchmark.py:60-102 — `release/nightly_tests/dataset/benchmark.py` and `release/nightly_tests/multimodal_inference_benchmarks/benchmark.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 9 separate duplicated blocks between them, totalling at least 302 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 (31–34 lines × 2) REDACTED:1948— REDACTED:1948-1978 | REDACTED:2225-2258 — both copies are in the same file, so extract the 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:1948` 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–34 lines × 2) python/ray/rllib/algorithms/sac/sac_tf_model.py:81— python/ray/rllib/algorithms/sac/sac_tf_model.py:81-111 | python/ray/rllib/algorithms/sac/sac_torch_model.py:75-108 — before extracting anything, compare `python/ray/rllib/algorithms/sac/sac_tf_model.py` and `python/ray/rllib/algorithms/sac/sac_torch_model.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 93 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 `python/ray/rllib/algorithms/sac/sac_tf_model.py:81` it begins part-way through the construct above it, so those 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, `python/ray/rllib/algorithms/sac/sac_torch_model.py:73` calls `__init__` and `python/ray/rllib/algorithms/sac/sac_tf_model.py:78` 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 (32 lines × 2) python/ray/air/_internal/tensorflow_utils.py:42— python/ray/air/_internal/tensorflow_utils.py:42-73 | python/ray/data/_internal/utils/tensorflow_utils.py:47-78 — before extracting anything, compare `python/ray/air/_internal/tensorflow_utils.py` and `python/ray/data/_internal/utils/tensorflow_utils.py` as WHOLE FILES: 93% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (32 lines × 2) python/ray/rllib/examples/envs/classes/multi_agent/pettingzoo_chess.py:180— python/ray/rllib/examples/envs/classes/multi_agent/pettingzoo_chess.py:180-211 | python/ray/rllib/examples/envs/classes/multi_agent/pettingzoo_connect4.py:164-195 — before extracting anything, compare `python/ray/rllib/examples/envs/classes/multi_agent/pettingzoo_chess.py` and `python/ray/rllib/examples/envs/classes/multi_agent/pettingzoo_connect4.py` as WHOLE FILES: 88% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (28–29 lines × 2) python/ray/rllib/algorithms/bc/bc_catalog.py:63— python/ray/rllib/algorithms/bc/bc_catalog.py:63-91 | python/ray/rllib/algorithms/ppo/ppo_catalog.py:134-161 — 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–29 lines × 2) release/air_tests/air_benchmarks/workloads/tensorflow_benchmark.py:254— release/air_tests/air_benchmarks/workloads/tensorflow_benchmark.py:254-282 | release/air_tests/air_benchmarks/workloads/torch_benchmark.py:416-443 — before extracting anything, compare `release/air_tests/air_benchmarks/workloads/tensorflow_benchmark.py` and `release/air_tests/air_benchmarks/workloads/torch_benchmark.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 155 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 (24–25 lines × 2) python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_map_operator.py:159— python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_map_operator.py:159-182 | python/ray/data/_internal/execution/operators/shuffle_operators/shuffle_map_operator.py:154-178 — before extracting anything, compare `python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_map_operator.py` and `python/ray/data/_internal/execution/operators/shuffle_operators/shuffle_map_operator.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 102 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 (24–25 lines × 2) python/ray/experimental/raysort/main.py:44— python/ray/experimental/raysort/main.py:44-67 | release/nightly_tests/dataset/multi_node_train_benchmark.py:112-136 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `python/ray/experimental/raysort/main.py:44` it begins part-way through the construct above it, so those 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 (23–25 lines × 2) python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_map_operator.py:246— python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_map_operator.py:246-270 | python/ray/data/_internal/execution/operators/shuffle_operators/shuffle_map_operator.py:237-259 — before extracting anything, compare `python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_map_operator.py` and `python/ray/data/_internal/execution/operators/shuffle_operators/shuffle_map_operator.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 102 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 `python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_map_operator.py:246` it begins part-way through the construct above it, so those 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, `python/ray/data/_internal/execution/operators/shuffle_operators/shuffle_map_operator.py:235` calls `list`, `MetadataOpTask` and `python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_map_operator.py:246` 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 (23–25 lines × 2) python/ray/rllib/models/torch/misc.py:29— python/ray/rllib/models/torch/misc.py:29-51 | python/ray/rllib/models/torch/misc.py:164-188 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22–23 lines × 2) python/ray/rllib/algorithms/iql/torch/iql_torch_learner.py:210— python/ray/rllib/algorithms/iql/torch/iql_torch_learner.py:210-232 | python/ray/rllib/algorithms/sac/torch/sac_torch_learner.py:407-428 — before extracting anything, compare `python/ray/rllib/algorithms/iql/torch/iql_torch_learner.py` and `python/ray/rllib/algorithms/sac/torch/sac_torch_learner.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 90 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 (22–23 lines × 2) python/ray/tune/logger/aim.py:161— python/ray/tune/logger/aim.py:161-182 | python/ray/tune/logger/tensorboardx.py:140-162 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (21–23 lines × 2) python/ray/rllib/policy/dynamic_tf_policy.py:418— python/ray/rllib/policy/dynamic_tf_policy.py:418-440 | python/ray/rllib/policy/dynamic_tf_policy_v2.py:101-121 — before extracting anything, compare `python/ray/rllib/policy/dynamic_tf_policy.py` and `python/ray/rllib/policy/dynamic_tf_policy_v2.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 422 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 `python/ray/rllib/policy/dynamic_tf_policy.py:418` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (21–23 lines × 2) REDACTED:272— REDACTED:272-292 | REDACTED:301-323 — both copies are in the same file, so extract the 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:301` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (22 lines × 3) python/ray/dashboard/modules/reporter/reporter_head.py:592— python/ray/dashboard/modules/reporter/reporter_head.py:592-613 | python/ray/dashboard/modules/reporter/reporter_head.py:676-697 | python/ray/dashboard/modules/reporter/reporter_head.py:856-877 — 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 (22 lines × 3) python/ray/rllib/algorithms/bc/bc_catalog.py:78— python/ray/rllib/algorithms/bc/bc_catalog.py:78-99 | python/ray/rllib/algorithms/ppo/ppo_catalog.py:148-169 | python/ray/rllib/algorithms/sac/sac_catalog.py:257-278 — 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 `python/ray/rllib/algorithms/bc/bc_catalog.py:78` 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–21 lines × 2) REDACTED:2489— REDACTED:2489-2504 | python/ray/rllib/examples/algorithms/classes/vpg.py:139-159 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:2489` 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–21 lines × 2) release/nightly_tests/dataset/tpch/tpch_q10.py:96— release/nightly_tests/dataset/tpch/tpch_q10.py:96-116 | release/nightly_tests/dataset/tpch/tpch_q3.py:65-80 — 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 `release/nightly_tests/dataset/tpch/tpch_q10.py:96` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (18–20 lines × 2) doc/source/serve/tutorials/video-analysis/ci/nb2py.py:7— doc/source/serve/tutorials/video-analysis/ci/nb2py.py:7-24 | doc/source/train/examples/transformers/transformer-reinforcement-learning/ci/nb2py.py:7-26 — before extracting anything, compare `doc/source/serve/tutorials/video-analysis/ci/nb2py.py` and `doc/source/train/examples/transformers/transformer-reinforcement-learning/ci/nb2py.py` as WHOLE FILES: 93% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (18–20 lines × 2) python/ray/rllib/algorithms/impala/vtrace_tf.py:270— python/ray/rllib/algorithms/impala/vtrace_tf.py:270-289 | python/ray/rllib/algorithms/impala/vtrace_torch.py:246-263 — 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 `python/ray/rllib/algorithms/impala/vtrace_tf.py:270` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (19–20 lines × 2) doc/source/train/doc_code/checkpoints.py:33— doc/source/train/doc_code/checkpoints.py:33-51 | doc/source/train/doc_code/checkpoints.py:114-133 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19–20 lines × 2) python/ray/rllib/models/torch/visionnet.py:59— python/ray/rllib/models/torch/visionnet.py:59-78 | python/ray/rllib/models/torch/visionnet.py:191-209 — both copies are in the same file, so extract the 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–18 lines × 2) python/ray/autoscaler/_private/commands.py:537— python/ray/autoscaler/_private/commands.py:537-554 | python/ray/autoscaler/_private/commands.py:636-650 — both copies are in the same file, so extract the 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 `python/ray/autoscaler/_private/commands.py:537` 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 (15–18 lines × 2) python/ray/data/_internal/iterator/push_split_coordinator.py:398— python/ray/data/_internal/iterator/push_split_coordinator.py:398-412 | python/ray/data/_internal/iterator/stream_split_iterator.py:320-337 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (11–15 lines × 2) python/ray/rllib/execution/train_ops.py:75— python/ray/rllib/execution/train_ops.py:75-85 | python/ray/rllib/execution/train_ops.py:191-205 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (11–15 lines × 2) python/ray/rllib/offline/offline_evaluation_runner.py:181— python/ray/rllib/offline/offline_evaluation_runner.py:181-191 | python/ray/rllib/offline/offline_policy_evaluation_runner.py:390-404 — before extracting anything, compare `python/ray/rllib/offline/offline_evaluation_runner.py` and `python/ray/rllib/offline/offline_policy_evaluation_runner.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 119 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 (12–14 lines × 2) python/ray/dashboard/modules/job/job_head.py:537— python/ray/dashboard/modules/job/job_head.py:537-550 | python/ray/util/state/state_manager.py:479-490 — 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 `python/ray/dashboard/modules/job/job_head.py:537` it begins part-way through the construct above it, so those 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–14 lines × 2) python/ray/rllib/offline/offline_env_runner.py:233— python/ray/rllib/offline/offline_env_runner.py:233-244 | python/ray/rllib/offline/offline_env_runner.py:274-287 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `python/ray/rllib/offline/offline_env_runner.py:274` 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 (13–14 lines × 2) python/ray/rllib/models/tf/visionnet.py:65— python/ray/rllib/models/tf/visionnet.py:65-78 | python/ray/rllib/models/tf/visionnet.py:208-220 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13–14 lines × 2) java/runtime/src/main/java/io/ray/runtime/util/generator/ParallelActorCallGenerator.java:26— java/runtime/src/main/java/io/ray/runtime/util/generator/ParallelActorCallGenerator.java:26-39 | java/runtime/src/main/java/io/ray/runtime/util/generator/RayCallGenerator.java:38-50 — before extracting anything, compare `java/runtime/src/main/java/io/ray/runtime/util/generator/ParallelActorCallGenerator.java` and `java/runtime/src/main/java/io/ray/runtime/util/generator/RayCallGenerator.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 192 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 `java/runtime/src/main/java/io/ray/runtime/util/generator/ParallelActorCallGenerator.java:26` 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, `java/runtime/src/main/java/io/ray/runtime/util/generator/RayCallGenerator.java:36` calls `newLine` and `java/runtime/src/main/java/io/ray/runtime/util/generator/ParallelActorCallGenerator.java:24` 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 (10–12 lines × 2) python/ray/cluster_utils.py:100— python/ray/cluster_utils.py:100-109 | REDACTED:1867-1878 — 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–12 lines × 2) python/ray/dag/format_utils.py:70— python/ray/dag/format_utils.py:70-79 | python/ray/dag/format_utils.py:128-139 — both copies are in the same file, so extract the 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 `python/ray/dag/format_utils.py:70` 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 (10–11 lines × 2) python/ray/rllib/policy/eager_tf_policy.py:978— python/ray/rllib/policy/eager_tf_policy.py:978-988 | python/ray/rllib/policy/eager_tf_policy_v2.py:906-915 — 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 `python/ray/rllib/policy/eager_tf_policy_v2.py:906` it begins part-way through the construct above it, so those 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–11 lines × 2) release/nightly_tests/dataset/tpch/tpch_q5.py:79— release/nightly_tests/dataset/tpch/tpch_q5.py:79-89 | release/nightly_tests/dataset/tpch/tpch_q7.py:84-93 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `release/nightly_tests/dataset/tpch/tpch_q5.py:79` it begins part-way through the construct above it, so those 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 × 4) doc/source/llm/doc_code/serve/direct_streaming/direct_streaming_custom_router_example.py:24— doc/source/llm/doc_code/serve/direct_streaming/direct_streaming_custom_router_example.py:24-34 | doc/source/llm/doc_code/serve/direct_streaming/direct_streaming_example.py:28-38 | doc/source/llm/doc_code/serve/prefix_aware_router/prefix_aware_example.py:21-31 | doc/source/llm/doc_code/serve/transcription/transcription_example.py:23-33 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times.
Duplicated block (11 lines × 4) python/ray/llm/_internal/serve/core/ingress/mixins/pausable.py:67— python/ray/llm/_internal/serve/core/ingress/mixins/pausable.py:67-84 | python/ray/llm/_internal/serve/core/ingress/mixins/pausable.py:87-97 | python/ray/llm/_internal/serve/core/ingress/mixins/sleepable.py:66-81 | python/ray/llm/_internal/serve/core/ingress/mixins/sleepable.py:84-94 — 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 `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 `body` to `PauseRequest` in one and `ResumeRequest` 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 (55 lines × 2) python/ray/train/examples/deepspeed/deepspeed_torch_trainer.py:68— python/ray/train/examples/deepspeed/deepspeed_torch_trainer.py:68-122 | python/ray/train/examples/deepspeed/deepspeed_torch_trainer_no_raydata.py:71-125 — 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 `python/ray/train/examples/deepspeed/deepspeed_torch_trainer.py:68` it begins part-way through the construct above it, so those 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 (55 lines × 2) release/nightly_tests/dataset/benchmark.py:317— release/nightly_tests/dataset/benchmark.py:317-371 | release/nightly_tests/multimodal_inference_benchmarks/benchmark.py:317-371 — `release/nightly_tests/dataset/benchmark.py` and `release/nightly_tests/multimodal_inference_benchmarks/benchmark.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 9 separate duplicated blocks between them, totalling at least 302 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 (13–16 lines × 2) python/ray/train/examples/accelerate/accelerate_torch_trainer_no_raydata.py:49— python/ray/train/examples/accelerate/accelerate_torch_trainer_no_raydata.py:49-61 | python/ray/train/examples/deepspeed/deepspeed_torch_trainer_no_raydata.py:36-51 — 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 `python/ray/train/examples/deepspeed/deepspeed_torch_trainer_no_raydata.py:36` it begins part-way through the construct above it, so those 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, `python/ray/train/examples/accelerate/accelerate_torch_trainer_no_raydata.py:62` calls `to`, `items` and `python/ray/train/examples/deepspeed/deepspeed_torch_trainer_no_raydata.py:52` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13–16 lines × 2) release/nightly_tests/dataset/profiling/perf.py:447— release/nightly_tests/dataset/profiling/perf.py:447-459 | REDACTED:442-457 — 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:442` it begins part-way through the construct above it, so those 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 (25 lines × 2 locations) python/ray/dashboard/client/src/common/links.tsx:6— python/ray/dashboard/client/src/common/links.tsx:6 · python/ray/dashboard/client/src/common/links.tsx:39 — 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 (25 lines × 2 locations) python/ray/dashboard/client/src/pages/node/NodeRow.tsx:77— python/ray/dashboard/client/src/pages/node/NodeRow.tsx:77 · python/ray/dashboard/client/src/pages/serve/ServeApplicationRow.tsx:45 — the 2 copies are spread across 2 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
Duplicated block (22 lines × 2 locations) python/ray/dashboard/client/src/common/ProfilingLink.tsx:544— python/ray/dashboard/client/src/common/ProfilingLink.tsx:544 · python/ray/dashboard/client/src/common/ProfilingLink.tsx:641 — 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 (22 lines × 2 locations) python/ray/dashboard/client/src/pages/serve/ServeEntityLogViewer.tsx:255— python/ray/dashboard/client/src/pages/serve/ServeEntityLogViewer.tsx:255 · python/ray/dashboard/client/src/pages/serve/ServeEntityLogViewer.tsx:285 — all 2 copies are in the same file, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
Duplicated block (19 lines × 3 locations) python/ray/dashboard/client/src/components/ActorTable.tsx:571— python/ray/dashboard/client/src/components/ActorTable.tsx:571 · python/ray/dashboard/client/src/components/PlacementGroupTable.tsx:157 · python/ray/dashboard/client/src/components/TaskTable.tsx:183 — the 3 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. There is one copy in each of 3 separate files rather than several in one place, so check first whether these are sibling modules that each declare their own version of one shape — one per entity, per provider, per language. Where they are, no single extracted module collapses them: each module still has to be written, and what recurs is the TEMPLATE. The moves that do collapse a template are to generate these modules from the set they enumerate, or to replace the repeated construction with one factory each site calls with its own values — and where the set is the point, each module pinning one distinct thing, the repetition IS the enumeration and there is nothing to delete.
Duplicated block (19 lines × 3 locations) REDACTED:390— REDACTED:390 · python/ray/dashboard/client/src/pages/serve/ServeApplicationDetailPage.tsx:206 · python/ray/dashboard/client/src/pages/serve/ServeDeploymentDetailPage.tsx:193 — the 3 copies are spread across 3 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
Duplicated block (17 lines × 2 locations) python/ray/dashboard/client/src/pages/job/JobDetailInfoPage.tsx:182— python/ray/dashboard/client/src/pages/job/JobDetailInfoPage.tsx:182 · python/ray/dashboard/client/src/pages/job/JobRow.tsx:120 — the 2 copies are spread across 2 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
Duplicated block (17 lines × 2 locations) python/ray/dashboard/client/src/pages/serve/ServeDeploymentMetricsSection.tsx:214— python/ray/dashboard/client/src/pages/serve/ServeDeploymentMetricsSection.tsx:214 · python/ray/dashboard/client/src/pages/serve/ServeMetricsSection.tsx:228 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
Duplicated block (15 lines × 5 locations) python/ray/dashboard/client/src/components/ActorTable.tsx:595— python/ray/dashboard/client/src/components/ActorTable.tsx:595 · python/ray/dashboard/client/src/components/TaskTable.tsx:201 · python/ray/dashboard/client/src/pages/job/JobTaskNameProgressTable/JobTaskNameProgressTable.tsx:47 · python/ray/dashboard/client/src/pages/job/index.tsx:154 · +1 more site(s) not listed — the 5 copies are spread across 5 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
Duplicated block (15 lines × 5 locations) python/ray/dashboard/client/src/components/DataOverviewTable.tsx:129— python/ray/dashboard/client/src/components/DataOverviewTable.tsx:129 · REDACTED:394 · python/ray/dashboard/client/src/pages/serve/ServeApplicationDetailPage.tsx:211 · python/ray/dashboard/client/src/pages/serve/ServeDeploymentDetailPage.tsx:198 · +1 more site(s) not listed — the 5 copies are spread across 5 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
Duplicated block (14 lines × 2 locations) python/ray/dashboard/client/src/common/ProfilingLink.tsx:477— python/ray/dashboard/client/src/common/ProfilingLink.tsx:477 · python/ray/dashboard/client/src/common/ProfilingLink.tsx:667 — 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) python/ray/dashboard/client/src/pages/job/hook/useJobProgress.ts:79— python/ray/dashboard/client/src/pages/job/hook/useJobProgress.ts:79 · python/ray/dashboard/client/src/pages/job/hook/useJobProgress.ts:315 — 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.
Dead file (~61 LoC) python/ray/dashboard/client/src/common/tableUtils.ts— no import path from any entry point (3 application, 10 tooling, 41 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (python/ray/dashboard/client/src/common/SortableTableHead.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~61 LoC) python/ray/dashboard/client/src/pages/state/hook/mockedPlacementGroup.ts— no import path from any entry point (3 application, 10 tooling, 41 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Blocking `time.sleep` inside an `async def` python/ray/_private/ray_microbenchmark_helpers.py:60— This `async def` runs on the event loop's thread, and `time.sleep` blocks that thread: for the whole delay no other coroutine, request or callback on the loop makes progress — the Python form of blocking on a task. Use `await asyncio.sleep(…)`, which suspends only this coroutine. Where the blocking work is not a sleep but a synchronous call that cannot be made async, move it off the loop with `await asyncio.to_thread(…)` (or `loop.run_in_executor(…)`).
Blocking `time.sleep` inside an `async def` python/ray/_private/runtime_env/agent/runtime_env_agent.py:676— This `async def` runs on the event loop's thread, and `time.sleep` blocks that thread: for the whole delay no other coroutine, request or callback on the loop makes progress — the Python form of blocking on a task. Use `await asyncio.sleep(…)`, which suspends only this coroutine. Where the blocking work is not a sleep but a synchronous call that cannot be made async, move it off the loop with `await asyncio.to_thread(…)` (or `loop.run_in_executor(…)`).
X2 · Cancellation propagation· Async function without AbortSignal · ×2
Async function without AbortSignal: authenticateWithToken python/ray/dashboard/client/src/authentication/authentication.ts:38— `authenticateWithToken` awaits `axios.post(…)` 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: `axios.post(url, { signal })`.
Async function without AbortSignal: readStream doc/source/_static/js/assistant.js:143— `readStream` 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 })`.
AC2 · Forms & labels· <Select> field component without a label · ×1
<Select> field component without a label python/ray/dashboard/client/src/pages/cmd/CMDResult.tsx:72— This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing it renders carries one either (a name prop is the form-submission key, not a label). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
AC3 · Page structure· Data table has no header cells · ×1
Data table has no header cells python/ray/widgets/templates/context_table.html.j2:1— 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).
Low contrast colour pair in CSS (2.8:1) python/ray/dashboard/client/src/components/LogView/index.css:7— `.hljs-dark span.find-kws` sets color: #ffffff on background-color: #b89700 — 2.8:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
AC6 · Visual & motion safety· Focus outline removed in CSS without a · ×1
Focus outline removed in CSS without a :focus replacement doc/source/_static/css/examples.css:34— `#examples-search-input:focus-visible` 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.
AC6 · Visual & motion safety· Animation without a prefers-reduced-motion guard · ×1
Animation without a prefers-reduced-motion guard doc/source/_static/css/assistant.css:37— `.search-button__wrapper.show ~ .chat-widget` moves (`animation: .4s jump ease infinite alternate`) 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.
AC7 · A11y enforcement· Accessibility enforcement below the top rung · ×1
Accessibility enforcement below the top rung — No accessibility enforcement found — no a11y linter (eslint-plugin-jsx-a11y) and no axe/pa11y/Lighthouse in tests or CI. Start with the linter to catch issues at author time. What was searched, so you can tell an absence from a miss: the 119 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.
tune.run (cyclomatic 86) python/ray/tune/tune.py:267— tune.run has cyclomatic complexity 86 (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.
Node.__init__ (cyclomatic 67) REDACTED:85— Node.__init__ has cyclomatic complexity 67 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
worker.init (cyclomatic 62) REDACTED:1447— worker.init 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.
AlgorithmConfig.get_multi_agent_setup (cyclomatic 57) python/ray/rllib/algorithms/algorithm_config.py:5849— AlgorithmConfig.get_multi_agent_setup has cyclomatic complexity 57 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CompiledDAG._get_or_compile (cyclomatic 56) python/ray/dag/compiled_dag_node.py:1556— CompiledDAG._get_or_compile 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.
ActorClass._remote (cyclomatic 55) python/ray/actor.py:1883— ActorClass._remote has cyclomatic complexity 55 (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.
AlgorithmConfig.env_runners (cyclomatic 54) python/ray/rllib/algorithms/algorithm_config.py:1891— AlgorithmConfig.env_runners has cyclomatic complexity 54 (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_init._setup_ray_cluster_internal (cyclomatic 54) REDACTED:799— cluster_init._setup_ray_cluster_internal has cyclomatic complexity 54 (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.
Algorithm.setup (cyclomatic 52) REDACTED:729— Algorithm.setup 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.
CompiledDAG._visualize_ascii (cyclomatic 51) python/ray/dag/compiled_dag_node.py:2684— CompiledDAG._visualize_ascii has cyclomatic complexity 51 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DeploymentStatusInfo.handle_transition (cyclomatic 49) python/ray/serve/_private/common.py:328— DeploymentStatusInfo.handle_transition has cyclomatic complexity 49 (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.
download_stock_videos.download_sample_videos (cyclomatic 46) doc/source/serve/tutorials/video-analysis/scripts/download_stock_videos.py:320— download_stock_videos.download_sample_videos 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.
RolloutWorker.__init__ (cyclomatic 46) REDACTED:216— RolloutWorker.__init__ has cyclomatic complexity 46 (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.
Learner._create_iterator_if_necessary (cyclomatic 45) python/ray/rllib/core/learner/learner.py:1259— Learner._create_iterator_if_necessary 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.
Deployment.options (cyclomatic 45) python/ray/serve/deployment.py:222— Deployment.options has cyclomatic complexity 45 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
CompiledDAG._preprocess (cyclomatic 44) python/ray/dag/compiled_dag_node.py:1088— CompiledDAG._preprocess 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.
AlgorithmConfig.offline_data (cyclomatic 43) python/ray/rllib/algorithms/algorithm_config.py:3310— AlgorithmConfig.offline_data 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.
ModelCatalog.get_model_v2 (cyclomatic 43) python/ray/rllib/models/catalog.py:334— ModelCatalog.get_model_v2 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.
ServeEntityLogViewer.ServeEntityLogViewer (cyclomatic 43) python/ray/dashboard/client/src/pages/serve/ServeEntityLogViewer.tsx:32— ServeEntityLogViewer.ServeEntityLogViewer has cyclomatic complexity 43 (threshold 15). Of this number, 29 points are the body's own statements and 14 belong to 3 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.
scripts.start (cyclomatic 41) python/ray/scripts/scripts.py:801— scripts.start 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.
application_state.override_deployment_info (cyclomatic 41) python/ray/serve/_private/application_state.py:1878— application_state.override_deployment_info 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.
DataServicer.Datapath (cyclomatic 41) python/ray/util/client/server/dataservicer.py:154— DataServicer.Datapath 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.
AlgorithmConfig.evaluation (cyclomatic 40) python/ray/rllib/algorithms/algorithm_config.py:2914— AlgorithmConfig.evaluation has cyclomatic complexity 40 (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.
services.start_raylet (cyclomatic 39) python/ray/_private/services.py:1610— services.start_raylet has cyclomatic complexity 39 (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.
_obstore_download._extract_credentials_from_filesystem (cyclomatic 39) python/ray/data/_internal/planner/_obstore_download.py:682— _obstore_download._extract_credentials_from_filesystem 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.
ActorTable.ActorTable (cyclomatic 39) python/ray/dashboard/client/src/components/ActorTable.tsx:86— ActorTable.ActorTable has cyclomatic complexity 39 (threshold 15). Most of this is not in the body itself: 4 of the 39 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 613, 131, 120, …). 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.
ParquetFileReader._iter_fragment_tables_without_pickle_check (cyclomatic 38) python/ray/data/_internal/datasource_v2/formats/parquet/parquet_file_reader.py:441— ParquetFileReader._iter_fragment_tables_without_pickle_check 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.
DynamicTFPolicy.__init__ (cyclomatic 38) python/ray/rllib/policy/dynamic_tf_policy.py:55— DynamicTFPolicy.__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.
Policy._initialize_loss_from_dummy_batch (cyclomatic 38) REDACTED:1302— Policy._initialize_loss_from_dummy_batch 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.
worker.connect (cyclomatic 37) REDACTED:2510— worker.connect 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.
DeploymentConfig.from_proto (cyclomatic 37) python/ray/serve/_private/config.py:463— DeploymentConfig.from_proto 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.
from_config.from_config (cyclomatic 36) python/ray/rllib/utils/from_config.py:19— from_config.from_config 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.
RayParams._check_usage (cyclomatic 35) python/ray/_private/parameter.py:352— RayParams._check_usage 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.
SerializationContext._deserialize_object (cyclomatic 35) REDACTED:424— SerializationContext._deserialize_object 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.
softwrap.reflow (cyclomatic 34) doc/.claude/skills/ray-soft-wrap/scripts/softwrap.py:132— softwrap.reflow 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.
JobSubmitRequest.__post_init__ (cyclomatic 33) python/ray/dashboard/modules/job/common.py:481— JobSubmitRequest.__post_init__ 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.
DynamicTFPolicy._initialize_loss_from_dummy_batch (cyclomatic 33) python/ray/rllib/policy/dynamic_tf_policy.py:718— DynamicTFPolicy._initialize_loss_from_dummy_batch 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.
worker._wait_generators_bulk (cyclomatic 31) REDACTED:3251— worker._wait_generators_bulk 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.
AzureNodeProvider._delete_node_and_resources (cyclomatic 31) python/ray/autoscaler/_private/_azure/node_provider.py:555— AzureNodeProvider._delete_node_and_resources has cyclomatic complexity 31 (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.
ReporterAgent._to_records (cyclomatic 31) REDACTED:1624— ReporterAgent._to_records 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.
DynamicTFPolicyV2._initialize_loss_from_dummy_batch (cyclomatic 31) python/ray/rllib/policy/dynamic_tf_policy_v2.py:676— DynamicTFPolicyV2._initialize_loss_from_dummy_batch 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.
rnn_sequencing.chop_into_sequences (cyclomatic 31) python/ray/rllib/policy/rnn_sequencing.py:268— rnn_sequencing.chop_into_sequences 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.
grafana_dashboard_factory._generate_panel_template (cyclomatic 30) python/ray/dashboard/modules/metrics/grafana_dashboard_factory.py:234— grafana_dashboard_factory._generate_panel_template 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.
ZarrV2Datasource.__init__ (cyclomatic 30) python/ray/data/_internal/datasource/zarrv2_datasource.py:277— ZarrV2Datasource.__init__ 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.
OperatorStatsSummary.from_block_metadata (cyclomatic 30) python/ray/data/_internal/stats.py:1774— OperatorStatsSummary.from_block_metadata 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.
DeploymentStateManager.update (cyclomatic 30) python/ray/serve/_private/deployment_state.py:7280— DeploymentStateManager.update 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.
App.App (cyclomatic 30) python/ray/dashboard/client/src/App.tsx:162— App.App has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 2 of the 30 points are its own statements and the rest belongs to 9 function items inside it that branch (a function literal at line 164, a function literal at line 249, a function literal at line 357, …). 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.
clang-tidy-diff.main (cyclomatic 29) ci/lint/clang-tidy-diff.py:113— clang-tidy-diff.main 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.
services.start_api_server (cyclomatic 29) python/ray/_private/services.py:1231— services.start_api_server 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.
AutoscalerEventLogger.log_cluster_scheduling_update (cyclomatic 29) python/ray/autoscaler/v2/event_logger.py:31— AutoscalerEventLogger.log_cluster_scheduling_update has cyclomatic complexity 29 (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.
streaming_executor_state.process_completed_tasks (cyclomatic 29) python/ray/data/_internal/execution/streaming_executor_state.py:794— streaming_executor_state.process_completed_tasks 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.
checkpoints.get_checkpoint_info (cyclomatic 29) REDACTED:729— checkpoints.get_checkpoint_info 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.
LogVirtualView.LogVirtualView (cyclomatic 29) python/ray/dashboard/client/src/components/LogView/LogVirtualView.tsx:197— LogVirtualView.LogVirtualView has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 6 of the 29 points are its own statements and the rest belongs to 8 function items inside it that branch (itemRenderer, a function literal at line 362, a function literal at line 317, …). 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.
NodeUpdater.do_update (cyclomatic 28) python/ray/autoscaler/_private/updater.py:341— NodeUpdater.do_update 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.
CompiledDAG.visualize (cyclomatic 28) python/ray/dag/compiled_dag_node.py:3051— CompiledDAG.visualize 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.
JobManager._monitor_job_internal (cyclomatic 28) python/ray/dashboard/modules/job/job_manager.py:152— JobManager._monitor_job_internal 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.
_obstore_download._download_uris_with_obstore (cyclomatic 28) python/ray/data/_internal/planner/_obstore_download.py:1210— _obstore_download._download_uris_with_obstore 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.
rnn_sequencing.pad_batch_to_sequences_of_same_size (cyclomatic 28) python/ray/rllib/policy/rnn_sequencing.py:35— rnn_sequencing.pad_batch_to_sequences_of_same_size 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.
RunnerGroup.sync_runner_states (cyclomatic 28) python/ray/rllib/utils/runners/runner_group.py:214— RunnerGroup.sync_runner_states 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.
RuntimeEnv.__init__ (cyclomatic 28) python/ray/runtime_env/runtime_env.py:333— RuntimeEnv.__init__ 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.
DeploymentState._check_startup_replicas (cyclomatic 28) python/ray/serve/_private/deployment_state.py:5023— DeploymentState._check_startup_replicas 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.
RayConfig.<init> (cyclomatic 28) java/runtime/src/main/java/io/ray/runtime/config/RayConfig.java:102— RayConfig.<init> 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.
config._configure_resource_group (cyclomatic 27) REDACTED:84— config._configure_resource_group 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.
IMPALAConfig.training (cyclomatic 27) python/ray/rllib/algorithms/impala/impala.py:190— IMPALAConfig.training 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.
SimpleListCollector.postprocess_episode (cyclomatic 27) python/ray/rllib/evaluation/collectors/simple_list_collector.py:420— SimpleListCollector.postprocess_episode 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.
EnvRunnerV2._process_observations (cyclomatic 27) python/ray/rllib/evaluation/env_runner_v2.py:431— EnvRunnerV2._process_observations 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.
rollout_ops.synchronous_parallel_sample (cyclomatic 27) python/ray/rllib/execution/rollout_ops.py:21— rollout_ops.synchronous_parallel_sample 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.
Replica._direct_ingress_asgi (cyclomatic 27) REDACTED:3122— Replica._direct_ingress_asgi 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.
services.start_ray_process (cyclomatic 26) python/ray/_private/services.py:883— services.start_ray_process 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.
commands.get_or_create_head_node (cyclomatic 26) python/ray/autoscaler/_private/commands.py:709— commands.get_or_create_head_node 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.
ResourceDemandScheduler._try_schedule (cyclomatic 26) python/ray/autoscaler/v2/scheduler.py:1722— ResourceDemandScheduler._try_schedule 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.
dag_node_operation._build_dag_node_operation_graph (cyclomatic 26) python/ray/dag/dag_node_operation.py:402— dag_node_operation._build_dag_node_operation_graph 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.
read_api.read_parquet (cyclomatic 26) python/ray/data/read_api.py:1667— read_api.read_parquet 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.
RemoteFunction._remote (cyclomatic 26) python/ray/remote_function.py:358— RemoteFunction._remote 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.
AlgorithmConfig._validate_offline_settings (cyclomatic 26) python/ray/rllib/algorithms/algorithm_config.py:5526— AlgorithmConfig._validate_offline_settings 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.
Stats.__init__ (cyclomatic 26) python/ray/rllib/utils/metrics/legacy_stats.py:45— Stats.__init__ 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.
sphinx_fix.render_human (cyclomatic 25) doc/.claude/skills/sphinx-fix/sphinx_fix.py:791— sphinx_fix.render_human 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.
dataset_repr.build_dataset_summary_repr (cyclomatic 25) python/ray/data/_internal/dataset_repr.py:349— dataset_repr.build_dataset_summary_repr 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.
kafka_datasource._validate_offsets (cyclomatic 25) python/ray/data/_internal/datasource/kafka_datasource.py:302— kafka_datasource._validate_offsets 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.
Algorithm._evaluate_with_fixed_duration (cyclomatic 25) REDACTED:2086— Algorithm._evaluate_with_fixed_duration 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.
AlgorithmConfig.multi_agent (cyclomatic 25) python/ray/rllib/algorithms/algorithm_config.py:3695— AlgorithmConfig.multi_agent 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.
AlgorithmConfig._validate_to_be_deprecated_settings (cyclomatic 25) python/ray/rllib/algorithms/algorithm_config.py:5422— AlgorithmConfig._validate_to_be_deprecated_settings 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.
AgentCollector.add_action_reward_next_obs (cyclomatic 25) python/ray/rllib/evaluation/collectors/agent_collector.py:235— AgentCollector.add_action_reward_next_obs 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.
DeploymentState.migrate_replicas_on_draining_nodes (cyclomatic 25) python/ray/serve/_private/deployment_state.py:6190— DeploymentState.migrate_replicas_on_draining_nodes 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.
setup.build (cyclomatic 25) python/setup.py:467— setup.build 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.
filter.filter_tests (cyclomatic 24) release/ray_release/buildkite/filter.py:22— filter.filter_tests 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.
FuseOperators._can_fuse (cyclomatic 24) python/ray/data/_internal/logical/rules/operator_fusion.py:274— FuseOperators._can_fuse 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.
DatasetStatsSummary.to_string (cyclomatic 24) python/ray/data/_internal/stats.py:1495— DatasetStatsSummary.to_string 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.
Algorithm.evaluate (cyclomatic 24) REDACTED:1392— Algorithm.evaluate 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.
AlgorithmConfig.update_from_dict (cyclomatic 24) python/ray/rllib/algorithms/algorithm_config.py:751— AlgorithmConfig.update_from_dict 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.
DQNConfig.training (cyclomatic 24) python/ray/rllib/algorithms/dqn/dqn.py:213— DQNConfig.training 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.
metrics.summarize_episodes (cyclomatic 24) python/ray/rllib/evaluation/metrics.py:131— metrics.summarize_episodes has cyclomatic complexity 24 (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.
MultiAgentEpisodeReplayBuffer._sample_synchonized (cyclomatic 24) python/ray/rllib/utils/replay_buffers/multi_agent_episode_buffer.py:857— MultiAgentEpisodeReplayBuffer._sample_synchonized 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.
symmetric_run.symmetric_run (cyclomatic 24) python/ray/scripts/symmetric_run.py:139— symmetric_run.symmetric_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.
Experiment.__init__ (cyclomatic 24) python/ray/tune/experiment/experiment.py:102— Experiment.__init__ 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.
ParallelActorCallGenerator.buildCalls (cyclomatic 24) java/runtime/src/main/java/io/ray/runtime/util/generator/ParallelActorCallGenerator.java:104— ParallelActorCallGenerator.buildCalls 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.
RayCallGenerator.buildCalls (cyclomatic 24) java/runtime/src/main/java/io/ray/runtime/util/generator/RayCallGenerator.java:166— RayCallGenerator.buildCalls 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.
working_dir.upload_working_dir_if_needed (cyclomatic 23) python/ray/_private/runtime_env/working_dir.py:41— working_dir.upload_working_dir_if_needed 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.
worker.get (cyclomatic 23) REDACTED:2900— worker.get 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.
_CliLogger.confirm (cyclomatic 23) python/ray/autoscaler/_private/cli_logger.py:591— _CliLogger.confirm 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.
_CollectiveOperation.__init__ (cyclomatic 23) python/ray/dag/collective_node.py:41— _CollectiveOperation.__init__ 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.
FileReader.read (cyclomatic 23) python/ray/data/_internal/datasource_v2/common/file_reader.py:186— FileReader.read 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.
DataContext.__setattr__ (cyclomatic 23) python/ray/data/context.py:1263— DataContext.__setattr__ has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Algorithm._checkpoint_info_to_algorithm_state (cyclomatic 23) REDACTED:4323— Algorithm._checkpoint_info_to_algorithm_state 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.
AlgorithmConfig.get_multi_rl_module_spec (cyclomatic 23) python/ray/rllib/algorithms/algorithm_config.py:4781— AlgorithmConfig.get_multi_rl_module_spec 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.
ModelCatalog.get_action_dist (cyclomatic 23) python/ray/rllib/models/catalog.py:142— ModelCatalog.get_action_dist 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.
VisionNetwork.__init__ (cyclomatic 23) python/ray/rllib/models/tf/visionnet.py:25— VisionNetwork.__init__ 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.
OfflinePreLearner._map_sample_batch_to_episode (cyclomatic 23) python/ray/rllib/offline/offline_prelearner.py:423— OfflinePreLearner._map_sample_batch_to_episode 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.
sample_batch.concat_samples (cyclomatic 23) python/ray/rllib/policy/sample_batch.py:1606— sample_batch.concat_samples 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.
DeploymentState._check_and_update_transitioning_replicas (cyclomatic 23) python/ray/serve/_private/deployment_state.py:5889— DeploymentState._check_and_update_transitioning_replicas 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.
setup-dev.do_link (cyclomatic 23) REDACTED:27— setup-dev.do_link 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.
tpu.run_on_slice (cyclomatic 23) python/ray/util/tpu.py:962— tpu.run_on_slice 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.
util.format_info_string (cyclomatic 22) python/ray/autoscaler/_private/util.py:853— util.format_info_string 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.
memory_utils.memory_summary (cyclomatic 22) python/ray/dashboard/memory_utils.py:374— memory_utils.memory_summary 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.
OrcFileReader._iter_fragment_tables (cyclomatic 22) python/ray/data/_internal/datasource_v2/formats/orc/orc_file_reader.py:46— OrcFileReader._iter_fragment_tables 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.
IterStatsSummary.to_string (cyclomatic 22) python/ray/data/_internal/stats.py:2147— IterStatsSummary.to_string 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.
AlgorithmConfig.training (cyclomatic 22) python/ray/rllib/algorithms/algorithm_config.py:2515— AlgorithmConfig.training 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.
DreamerV3Config.training (cyclomatic 22) python/ray/rllib/algorithms/dreamerv3/dreamerv3.py:174— DreamerV3Config.training 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.
SACConfig.validate (cyclomatic 22) python/ray/rllib/algorithms/sac/sac.py:390— SACConfig.validate 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.
TFPolicy.__init__ (cyclomatic 22) python/ray/rllib/policy/tf_policy.py:88— TFPolicy.__init__ 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.
TorchPolicy.__init__ (cyclomatic 22) python/ray/rllib/policy/torch_policy.py:64— TorchPolicy.__init__ 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.
PopulationBasedTraining.on_trial_result (cyclomatic 22) python/ray/tune/schedulers/pbt.py:526— PopulationBasedTraining.on_trial_result 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.
TaskTable.TaskTable (cyclomatic 22) python/ray/dashboard/client/src/components/TaskTable.tsx:42— TaskTable.TaskTable has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 4 of the 22 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 218, 141, 176, …). 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.
PlatformEvents.PlatformEvents (cyclomatic 22) python/ray/dashboard/client/src/pages/events/PlatformEvents.tsx:35— PlatformEvents.PlatformEvents has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 7 of the 22 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 246, 80, 102, …). 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.
py_modules.upload_py_modules_if_needed (cyclomatic 21) python/ray/_private/runtime_env/py_modules.py:50— py_modules.upload_py_modules_if_needed 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.
ReporterAgent._get_tpu_usage (cyclomatic 21) REDACTED:865— ReporterAgent._get_tpu_usage 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.
ActorPoolStrategy.__init__ (cyclomatic 21) python/ray/data/_internal/compute.py:109— ActorPoolStrategy.__init__ 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.
cql_torch_policy.cql_loss (cyclomatic 21) python/ray/rllib/algorithms/cql/cql_torch_policy.py:83— cql_torch_policy.cql_loss 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.
SACConfig.training (cyclomatic 21) python/ray/rllib/algorithms/sac/sac.py:140— SACConfig.training 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.
rnn_sequencing.timeslice_along_seq_lens_with_overlap (cyclomatic 21) python/ray/rllib/policy/rnn_sequencing.py:463— rnn_sequencing.timeslice_along_seq_lens_with_overlap 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.check_memory_leaks (cyclomatic 21) python/ray/rllib/utils/debug/memory.py:16— memory.check_memory_leaks 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.
MultiAgentPrioritizedEpisodeReplayBuffer.add (cyclomatic 21) python/ray/rllib/utils/replay_buffers/multi_agent_prioritized_episode_buffer.py:206— MultiAgentPrioritizedEpisodeReplayBuffer.add 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.
DeploymentConfig.to_proto (cyclomatic 21) python/ray/serve/_private/config.py:356— DeploymentConfig.to_proto 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.
HTTPProxy.send_request_to_replica (cyclomatic 21) REDACTED:1280— HTTPProxy.send_request_to_replica 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.ray_dask_get (cyclomatic 21) python/ray/util/dask/scheduler.py:93— scheduler.ray_dask_get 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.
ActorDetail.ActorDetailPage (cyclomatic 21) python/ray/dashboard/client/src/pages/actor/ActorDetail.tsx:53— ActorDetail.ActorDetailPage 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.
NodeDetail.NodeDetailPage (cyclomatic 21) python/ray/dashboard/client/src/pages/node/NodeDetail.tsx:15— NodeDetail.NodeDetailPage has cyclomatic complexity 21 (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.
_anyscale_job_wrapper.main (cyclomatic 20) release/ray_release/command_runner/_anyscale_job_wrapper.py:504— _anyscale_job_wrapper.main 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.
run_docstring_examples.main (cyclomatic 20) ci/ray_ci/doc/run_docstring_examples.py:319— run_docstring_examples.main 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.
validation.parse_and_validate_uv (cyclomatic 20) python/ray/_private/runtime_env/validation.py:165— validation.parse_and_validate_uv 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.
services.determine_plasma_store_config (cyclomatic 20) python/ray/_private/services.py:2182— services.determine_plasma_store_config 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.
ReportHead.memory_profile (cyclomatic 20) python/ray/dashboard/modules/reporter/reporter_head.py:939— ReportHead.memory_profile 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.
DefaultActorAutoscaler._derive_target_scaling_config (cyclomatic 20) python/ray/data/_internal/actor_autoscaler/default_actor_autoscaler.py:52— DefaultActorAutoscaler._derive_target_scaling_config 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.
iter_batches.prefetch_batches_locally (cyclomatic 20) python/ray/data/_internal/block_batching/iter_batches.py:454— iter_batches.prefetch_batches_locally 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.
ClickHouseDatasink.on_write_start (cyclomatic 20) python/ray/data/_internal/datasource/clickhouse_datasink.py:307— ClickHouseDatasink.on_write_start 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.
DataType.from_dtype (cyclomatic 20) python/ray/data/datatype.py:411— DataType.from_dtype 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.
read_api._read_datasource_v2 (cyclomatic 20) python/ray/data/read_api.py:500— read_api._read_datasource_v2 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.
AlgorithmConfig.build_env_to_module_connector (cyclomatic 20) python/ray/rllib/algorithms/algorithm_config.py:1021— AlgorithmConfig.build_env_to_module_connector 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.
AddStatesFromEpisodesToBatch.__call__ (cyclomatic 20) python/ray/rllib/connectors/common/add_states_from_episodes_to_batch.py:211— AddStatesFromEpisodesToBatch.__call__ 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.
TorchMLP.__init__ (cyclomatic 20) python/ray/rllib/core/models/torch/primitives.py:27— TorchMLP.__init__ 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.
SimpleListCollector.get_inference_input_dict (cyclomatic 20) python/ray/rllib/evaluation/collectors/simple_list_collector.py:317— SimpleListCollector.get_inference_input_dict 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.
TFMultiGPUTowerStack.__init__ (cyclomatic 20) python/ray/rllib/policy/dynamic_tf_policy.py:945— TFMultiGPUTowerStack.__init__ has cyclomatic complexity 20 (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.
Stats._reduced_values (cyclomatic 20) python/ray/rllib/utils/metrics/legacy_stats.py:821— Stats._reduced_values 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.
MultiAgentPrioritizedReplayBuffer._add_to_underlying_buffer (cyclomatic 20) python/ray/rllib/utils/replay_buffers/multi_agent_prioritized_replay_buffer.py:149— MultiAgentPrioritizedReplayBuffer._add_to_underlying_buffer 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.
utils.validate_buffer_config (cyclomatic 20) python/ray/rllib/utils/replay_buffers/utils.py:206— utils.validate_buffer_config 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.
scripts.run (cyclomatic 20) python/ray/serve/scripts.py:461— scripts.run 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.
commands.list_trials (cyclomatic 20) python/ray/tune/cli/commands.py:97— commands.list_trials 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.
TBXLoggerCallback.log_trial_result (cyclomatic 20) python/ray/tune/logger/tensorboardx.py:57— TBXLoggerCallback.log_trial_result 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.
AxSearch._setup_experiment (cyclomatic 20) python/ray/tune/search/ax/ax_search.py:199— AxSearch._setup_experiment 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_utils.get_async (cyclomatic 20) python/ray/util/dask/scheduler_utils.py:242— scheduler_utils.get_async 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.
common.protobuf_to_task_state_dict (cyclomatic 20) python/ray/util/state/common.py:1625— common.protobuf_to_task_state_dict 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.
TaskExecutor.execute (cyclomatic 20) java/runtime/src/main/java/io/ray/runtime/task/TaskExecutor.java:98— TaskExecutor.execute 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.
AdvancedProgressBar.AdvancedProgressBarSegment (cyclomatic 20) python/ray/dashboard/client/src/pages/job/AdvancedProgressBar/AdvancedProgressBar.tsx:78— AdvancedProgressBar.AdvancedProgressBarSegment has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs 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.
validation.parse_and_validate_pip (cyclomatic 19) python/ray/_private/runtime_env/validation.py:269— validation.parse_and_validate_pip 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.
services.get_node_to_connect_for_driver (cyclomatic 19) python/ray/_private/services.py:512— services.get_node_to_connect_for_driver 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.
ParquetDatasink.__init__ (cyclomatic 19) python/ray/data/_internal/datasource/parquet_datasink.py:174— ParquetDatasink.__init__ 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.
ParquetDatasource.__init__ (cyclomatic 19) python/ray/data/_internal/datasource/parquet_datasource.py:213— ParquetDatasource.__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.
tfrecords_datasink._value_to_feature (cyclomatic 19) python/ray/data/_internal/datasource/tfrecords_datasink.py:89— tfrecords_datasink._value_to_feature 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.
util.get_compute_strategy (cyclomatic 19) python/ray/data/_internal/util.py:597— util.get_compute_strategy 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.
Algorithm.compute_single_action (cyclomatic 19) REDACTED:4662— Algorithm.compute_single_action 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.
AlgorithmConfig.build_module_to_env_connector (cyclomatic 19) python/ray/rllib/algorithms/algorithm_config.py:1134— AlgorithmConfig.build_module_to_env_connector 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.
AlgorithmConfig.callbacks (cyclomatic 19) python/ray/rllib/algorithms/algorithm_config.py:2740— AlgorithmConfig.callbacks 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.
AlgorithmConfig.get_rl_module_spec (cyclomatic 19) python/ray/rllib/algorithms/algorithm_config.py:4690— AlgorithmConfig.get_rl_module_spec 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.
utils.get_activation_fn (cyclomatic 19) python/ray/rllib/models/utils.py:8— utils.get_activation_fn 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.
Policy._update_model_view_requirements_from_init_state (cyclomatic 19) REDACTED:1577— Policy._update_model_view_requirements_from_init_state 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.
SampleBatch.__init__ (cyclomatic 19) python/ray/rllib/policy/sample_batch.py:158— SampleBatch.__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.
SampleBatch.slice (cyclomatic 19) python/ray/rllib/policy/sample_batch.py:616— SampleBatch.slice 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.
TFPolicy._initialize_loss (cyclomatic 19) python/ray/rllib/policy/tf_policy.py:692— TFPolicy._initialize_loss 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.
Checkpointable.save_to_path (cyclomatic 19) REDACTED:95— Checkpointable.save_to_path 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.
MetricsLogger._maybe_create_stats_object (cyclomatic 19) python/ray/rllib/utils/metrics/metrics_logger.py:265— MetricsLogger._maybe_create_stats_object 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.
ApplicationState.apply_app_config (cyclomatic 19) python/ray/serve/_private/application_state.py:687— ApplicationState.apply_app_config 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.
ServeController.run_control_loop_step (cyclomatic 19) REDACTED:668— ServeController.run_control_loop_step has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DeploymentState._stop_or_update_outdated_version_replicas (cyclomatic 19) python/ray/serve/_private/deployment_state.py:4268— DeploymentState._stop_or_update_outdated_version_replicas 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.
ProxyState._reconcile_internal (cyclomatic 19) python/ray/serve/_private/proxy_state.py:527— ProxyState._reconcile_internal 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.
TrainContext.report (cyclomatic 19) python/ray/train/v2/_internal/execution/context.py:401— TrainContext.report 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.
tpu._get_intact_tpu_slices (cyclomatic 19) python/ray/util/tpu.py:310— tpu._get_intact_tpu_slices 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.
Termynal.constructor (cyclomatic 19) doc/source/_static/js/termynal.js:30— Termynal.constructor 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.
usage_lib.get_cluster_config_to_report (cyclomatic 18) python/ray/_common/usage/usage_lib.py:751— usage_lib.get_cluster_config_to_report has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
packaging.download_and_unpack_package (cyclomatic 18) REDACTED:881— packaging.download_and_unpack_package 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.
utils._get_docker_cpus (cyclomatic 18) python/ray/_private/utils.py:365— utils._get_docker_cpus 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.
ActorMethod._remote (cyclomatic 18) python/ray/actor.py:1079— ActorMethod._remote 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.
wandb._clean_log (cyclomatic 18) REDACTED:219— wandb._clean_log 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.
sdk.request_resources (cyclomatic 18) python/ray/autoscaler/sdk/sdk.py:215— sdk.request_resources 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.
NvidiaGpuProvider._get_gpu_info (cyclomatic 18) python/ray/dashboard/modules/reporter/gpu_providers.py:412— NvidiaGpuProvider._get_gpu_info 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.
LeRobotDatasource.__init__ (cyclomatic 18) python/ray/data/_internal/datasource/lerobot_datasource.py:1458— LeRobotDatasource.__init__ 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.
join._join_tables_iter (cyclomatic 18) python/ray/data/_internal/execution/operators/join.py:227— join._join_tables_iter 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.
pandas_block._reconcile_arrow_backed_int_float_columns (cyclomatic 18) python/ray/data/_internal/pandas_block.py:68— pandas_block._reconcile_arrow_backed_int_float_columns 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.
PushBasedShuffleTaskScheduler.execute (cyclomatic 18) python/ray/data/_internal/planner/exchange/push_based_shuffle_task_scheduler.py:449— PushBasedShuffleTaskScheduler.execute has cyclomatic complexity 18 (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.
SplitRepartitionTaskScheduler.execute (cyclomatic 18) python/ray/data/_internal/planner/exchange/split_repartition_task_scheduler.py:32— SplitRepartitionTaskScheduler.execute 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.
scheduling_overhead.collect_scheduling_overhead (cyclomatic 18) python/ray/data/_internal/scheduling_overhead.py:172— scheduling_overhead.collect_scheduling_overhead 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.
PDOrchestratorMixin._can_reuse_prompt_token_ids (cyclomatic 18) python/ray/llm/_internal/serve/serving_patterns/prefill_decode/pd_server.py:172— PDOrchestratorMixin._can_reuse_prompt_token_ids 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.
Algorithm.compute_actions (cyclomatic 18) REDACTED:4782— Algorithm.compute_actions 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.
DQNConfig.validate (cyclomatic 18) python/ray/rllib/algorithms/dqn/dqn.py:426— DQNConfig.validate 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.
TorchPolicyV2.__init__ (cyclomatic 18) python/ray/rllib/policy/torch_policy_v2.py:66— TorchPolicyV2.__init__ 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.
Stats.merge_in_parallel (cyclomatic 18) python/ray/rllib/utils/metrics/legacy_stats.py:458— Stats.merge_in_parallel 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.
TensorFlowVariables.__init__ (cyclomatic 18) python/ray/rllib/utils/tf_utils.py:843— TensorFlowVariables.__init__ 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.
ActorReplicaWrapper.check_ready (cyclomatic 18) python/ray/serve/_private/deployment_state.py:1556— ActorReplicaWrapper.check_ready 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.
HAProxyManager.serving (cyclomatic 18) REDACTED:2026— HAProxyManager.serving 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.
RequestRouter._fulfill_pending_requests (cyclomatic 18) python/ray/serve/_private/request_router/request_router.py:1267— RequestRouter._fulfill_pending_requests 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.
autoscaling_policy._query_prometheus (cyclomatic 18) REDACTED:468— autoscaling_policy._query_prometheus 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.
ScalingConfig._validate_tpu_config (cyclomatic 18) python/ray/train/v2/api/config.py:204— ScalingConfig._validate_tpu_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.
NevergradSearch.__init__ (cyclomatic 18) REDACTED:123— NevergradSearch.__init__ has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ObjectSerializer.deserialize (cyclomatic 18) java/runtime/src/main/java/io/ray/runtime/object/ObjectSerializer.java:90— ObjectSerializer.deserialize 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.
step.get_step (cyclomatic 17) release/ray_release/buildkite/step.py:122— step.get_step 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.
softwrap.main (cyclomatic 17) doc/.claude/skills/ray-soft-wrap/scripts/softwrap.py:409— softwrap.main 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.
Node._kill_process_impl (cyclomatic 17) REDACTED:1868— Node._kill_process_impl 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.
Worker.get_objects (cyclomatic 17) REDACTED:965— Worker.get_objects 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.
worker.wait (cyclomatic 17) REDACTED:3107— worker.wait 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.
DockerCommandRunner.run_init (cyclomatic 17) python/ray/autoscaler/_private/command_runner.py:762— DockerCommandRunner.run_init 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.
ReporterAgent._async_get_workers_and_agents (cyclomatic 17) REDACTED:1157— ReporterAgent._async_get_workers_and_agents 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.
state_api_utils.do_filter (cyclomatic 17) python/ray/dashboard/state_api_utils.py:198— state_api_utils.do_filter 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.
_AutoscalingCoordinatorActor.request_resources (cyclomatic 17) python/ray/data/_internal/cluster_autoscaler/default_autoscaling_coordinator.py:391— _AutoscalingCoordinatorActor.request_resources 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.
_AutoscalingCoordinatorActor._refresh_resource_reservations (cyclomatic 17) python/ray/data/_internal/cluster_autoscaler/default_autoscaling_coordinator.py:629— _AutoscalingCoordinatorActor._refresh_resource_reservations 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.
clickhouse_datasink._arrow_to_clickhouse_type (cyclomatic 17) python/ray/data/_internal/datasource/clickhouse_datasink.py:46— clickhouse_datasink._arrow_to_clickhouse_type 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.
delta_datasink._nested_schema_additions (cyclomatic 17) REDACTED:50— delta_datasink._nested_schema_additions 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.
KafkaDatasource.__init__ (cyclomatic 17) python/ray/data/_internal/datasource/kafka_datasource.py:467— KafkaDatasource.__init__ 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.
HiveReadSpec.__post_init__ (cyclomatic 17) python/ray/data/_internal/datasource_v2/formats/hive/hive_contract.py:45— HiveReadSpec.__post_init__ 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.
OpRuntimeMetrics.on_task_output_generated (cyclomatic 17) python/ray/data/_internal/execution/interfaces/op_runtime_metrics.py:1042— OpRuntimeMetrics.on_task_output_generated 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.
DataOpTask.on_data_ready (cyclomatic 17) REDACTED:252— DataOpTask.on_data_ready 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.
FuseOperators._get_fused_map_operator (cyclomatic 17) python/ray/data/_internal/logical/rules/operator_fusion.py:594— FuseOperators._get_fused_map_operator 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.
PredicatePushdown._try_push_down_predicate (cyclomatic 17) python/ray/data/_internal/logical/rules/predicate_pushdown.py:255— PredicatePushdown._try_push_down_predicate 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.
plan_all_to_all_op.plan_all_to_all_op (cyclomatic 17) python/ray/data/_internal/planner/plan_all_to_all_op.py:390— plan_all_to_all_op.plan_all_to_all_op 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.
OperatorStatsSummary.__str__ (cyclomatic 17) python/ray/data/_internal/stats.py:1928— OperatorStatsSummary.__str__ 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.
ArrowTensorArray._from_numpy (cyclomatic 17) python/ray/data/_internal/tensor_extensions/arrow.py:909— ArrowTensorArray._from_numpy 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.
NixlTensorTransport.fetch_multiple_tensors (cyclomatic 17) python/ray/experimental/rdt/nixl_tensor_transport.py:376— NixlTensorTransport.fetch_multiple_tensors 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.
broadcast.broadcast (cyclomatic 17) REDACTED:17— broadcast.broadcast 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.
AlgorithmConfig.fault_tolerance (cyclomatic 17) python/ray/rllib/algorithms/algorithm_config.py:4036— AlgorithmConfig.fault_tolerance 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. This is NOT this file's highest cyclomatic complexity: AlgorithmConfig._translate_special_keys (cyclomatic 18) 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.
APPOConfig.training (cyclomatic 17) python/ray/rllib/algorithms/appo/appo.py:166— APPOConfig.training 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.
IMPALA.training_step (cyclomatic 17) python/ray/rllib/algorithms/impala/impala.py:656— IMPALA.training_step 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.
BatchIndividualItems.__call__ (cyclomatic 17) python/ray/rllib/connectors/common/batch_individual_items.py:132— BatchIndividualItems.__call__ 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.
TorchLearner.apply_gradients (cyclomatic 17) python/ray/rllib/core/learner/torch/torch_learner.py:200— TorchLearner.apply_gradients 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.
TorchMultiStreamEncoder.__init__ (cyclomatic 17) python/ray/rllib/core/models/torch/encoder.py:306— TorchMultiStreamEncoder.__init__ 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.
RLModuleSpec.update (cyclomatic 17) python/ray/rllib/core/rl_module/rl_module.py:196— RLModuleSpec.update 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.
utils.get_filter_config (cyclomatic 17) python/ray/rllib/models/utils.py:169— utils.get_filter_config 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.
dataset_reader.get_dataset_and_shards (cyclomatic 17) python/ray/rllib/offline/dataset_reader.py:71— dataset_reader.get_dataset_and_shards 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.
TorchPolicy.learn_on_loaded_batch (cyclomatic 17) python/ray/rllib/policy/torch_policy.py:537— TorchPolicy.learn_on_loaded_batch 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.
TorchPolicyV2.learn_on_loaded_batch (cyclomatic 17) python/ray/rllib/policy/torch_policy_v2.py:716— TorchPolicyV2.learn_on_loaded_batch 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.
MultiAgentMixInReplayBuffer.add (cyclomatic 17) python/ray/rllib/utils/replay_buffers/multi_agent_mixin_replay_buffer.py:199— MultiAgentMixInReplayBuffer.add has cyclomatic complexity 17 (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.
ApplicationState._reconcile_build_app_task (cyclomatic 17) python/ray/serve/_private/application_state.py:904— ApplicationState._reconcile_build_app_task 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.
build_app.build_app (cyclomatic 17) python/ray/serve/_private/build_app.py:131— build_app.build_app 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.
ServeControllerClient.deploy_applications (cyclomatic 17) python/ray/serve/_private/client.py:274— ServeControllerClient.deploy_applications 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.
DeploymentScheduler._find_best_node_to_compact (cyclomatic 17) python/ray/serve/_private/deployment_scheduler.py:1722— DeploymentScheduler._find_best_node_to_compact 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.
HAProxyMetricsCollector.record (cyclomatic 17) REDACTED:326— HAProxyMetricsCollector.record 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.
train_loop_utils.prepare_model (cyclomatic 17) python/ray/train/v2/torch/train_loop_utils.py:166— train_loop_utils.prepare_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.
HyperBandForBOHB.choose_trial_to_run (cyclomatic 17) python/ray/tune/schedulers/hb_bohb.py:127— HyperBandForBOHB.choose_trial_to_run 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.
HyperBandScheduler._process_bracket (cyclomatic 17) python/ray/tune/schedulers/hyperband.py:247— HyperBandScheduler._process_bracket 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.
DataServicerProxy.Datapath (cyclomatic 17) REDACTED:723— DataServicerProxy.Datapath 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.
SlicePlacementGroup._reserve_slice (cyclomatic 17) python/ray/util/tpu.py:633— SlicePlacementGroup._reserve_slice 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.
Node._init_gcs_client (cyclomatic 16) REDACTED:965— Node._init_gcs_client 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.
LogDeduplicator.deduplicate (cyclomatic 16) python/ray/_private/ray_logging/__init__.py:263— LogDeduplicator.deduplicate 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.
packaging.unzip_package (cyclomatic 16) REDACTED:1121— packaging.unzip_package 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.
ActorHandle._actor_method_call (cyclomatic 16) python/ray/actor.py:2486— ActorHandle._actor_method_call 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.
config._usable_subnet_ids (cyclomatic 16) python/ray/autoscaler/_private/aws/config.py:466— config._usable_subnet_ids 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.
cluster_dump._info_from_params (cyclomatic 16) python/ray/autoscaler/_private/cluster_dump.py:590— cluster_dump._info_from_params 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.
JobSupervisor.run (cyclomatic 16) REDACTED:317— JobSupervisor.run 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.
delta_datasink._explicit_filesystem_from_storage_options (cyclomatic 16) REDACTED:891— delta_datasink._explicit_filesystem_from_storage_options 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.
parquet_datasource._iter_batches_fallback (cyclomatic 16) python/ray/data/_internal/datasource/parquet_datasource.py:1076— parquet_datasource._iter_batches_fallback 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.
OpRuntimeMetrics.on_task_finished (cyclomatic 16) python/ray/data/_internal/execution/interfaces/op_runtime_metrics.py:1147— OpRuntimeMetrics.on_task_finished 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.
ReservationOpResourceAllocator.update_budgets (cyclomatic 16) python/ray/data/_internal/execution/resource_manager.py:981— ReservationOpResourceAllocator.update_budgets 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.
numpy_support.convert_to_numpy (cyclomatic 16) python/ray/data/_internal/numpy_support.py:120— numpy_support.convert_to_numpy 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.
Dataset.split (cyclomatic 16) REDACTED:2741— Dataset.split 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.
path_util._resolve_single_path_with_fallback (cyclomatic 16) python/ray/data/datasource/path_util.py:309— path_util._resolve_single_path_with_fallback 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.
S3FileSystem.download_files (cyclomatic 16) python/ray/llm/_internal/common/utils/cloud_filesystem/s3_filesystem.py:230— S3FileSystem.download_files 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.
PDOrchestratorMixin._pd_handle_request (cyclomatic 16) python/ray/llm/_internal/serve/serving_patterns/prefill_decode/pd_server.py:247— PDOrchestratorMixin._pd_handle_request 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.
PDOrchestratorMixin._concurrent_decode (cyclomatic 16) python/ray/llm/_internal/serve/serving_patterns/prefill_decode/pd_server.py:399— PDOrchestratorMixin._concurrent_decode 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.
AlgorithmConfig.framework (cyclomatic 16) python/ray/rllib/algorithms/algorithm_config.py:1627— AlgorithmConfig.framework 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: AlgorithmConfig._translate_special_keys (cyclomatic 18) 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.
AlgorithmConfig.learners (cyclomatic 16) python/ray/rllib/algorithms/algorithm_config.py:2355— AlgorithmConfig.learners 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: AlgorithmConfig._translate_special_keys (cyclomatic 18) 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.
cql_tf_policy.cql_loss (cyclomatic 16) python/ray/rllib/algorithms/cql/cql_tf_policy.py:85— cql_tf_policy.cql_loss 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.
AddTimeDimToBatchAndZeroPad.__call__ (cyclomatic 16) python/ray/rllib/connectors/common/add_time_dim_to_batch_and_zero_pad.py:182— AddTimeDimToBatchAndZeroPad.__call__ 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.
AgentToModuleMapping.__call__ (cyclomatic 16) python/ray/rllib/connectors/common/agent_to_module_mapping.py:166— AgentToModuleMapping.__call__ 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.
AgentCollector.build_for_training (cyclomatic 16) python/ray/rllib/evaluation/collectors/agent_collector.py:396— AgentCollector.build_for_training 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.
ModelV2.__call__ (cyclomatic 16) python/ray/rllib/models/modelv2.py:187— ModelV2.__call__ 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.
json_reader.postprocess_actions (cyclomatic 16) python/ray/rllib/offline/json_reader.py:105— json_reader.postprocess_actions 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.
legacy_stats.merge_stats (cyclomatic 16) python/ray/rllib/utils/metrics/legacy_stats.py:961— legacy_stats.merge_stats 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.
numpy.flatten_inputs_to_1d_tensor (cyclomatic 16) python/ray/rllib/utils/numpy.py:205— numpy.flatten_inputs_to_1d_tensor 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.
EpisodeReplayBuffer._sample_episodes (cyclomatic 16) python/ray/rllib/utils/replay_buffers/episode_replay_buffer.py:807— EpisodeReplayBuffer._sample_episodes 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.
ReplicaConfig.create (cyclomatic 16) python/ray/serve/_private/config.py:806— ReplicaConfig.create 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.
ReplicaConfig._validate_placement_group_options (cyclomatic 16) python/ray/serve/_private/config.py:935— ReplicaConfig._validate_placement_group_options 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.
DeploymentState.deploy (cyclomatic 16) python/ray/serve/_private/deployment_state.py:3967— DeploymentState.deploy 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.
DeploymentState.check_and_update_replicas (cyclomatic 16) python/ray/serve/_private/deployment_state.py:5668— DeploymentState.check_and_update_replicas 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.
api.deployment (cyclomatic 16) python/ray/serve/api.py:541— api.deployment 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.
CapacityQueueRouter._choose_replica_for_request (cyclomatic 16) python/ray/serve/experimental/capacity_queue_router.py:127— CapacityQueueRouter._choose_replica_for_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.
_TorchAccelerator.prepare_model (cyclomatic 16) python/ray/train/torch/train_loop_utils.py:385— _TorchAccelerator.prepare_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.
commands.list_experiments (cyclomatic 16) python/ray/tune/cli/commands.py:202— commands.list_experiments 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.
TuneController._validate_result_metrics (cyclomatic 16) python/ray/tune/execution/tune_controller.py:1642— TuneController._validate_result_metrics 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.
NevergradSearch._setup_nevergrad (cyclomatic 16) REDACTED:201— NevergradSearch._setup_nevergrad 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.
callback._create_default_callbacks (cyclomatic 16) python/ray/tune/utils/callback.py:35— callback._create_default_callbacks 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.
Worker._connect_channel (cyclomatic 16) REDACTED:250— Worker._connect_channel 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.
api-nav-loader.init (cyclomatic 16) doc/source/_static/api-nav-loader.js:11— api-nav-loader.init has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 3 of the 16 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 26, 61, 22, …). 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.
JobRow.JobRow (cyclomatic 16) python/ray/dashboard/client/src/pages/job/JobRow.tsx:21— JobRow.JobRow has cyclomatic complexity 16 (threshold 15). Of this number, 11 points are the body's own statements and 5 belong 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.
DataOverviewTable.DataRow (cyclomatic 16) python/ray/dashboard/client/src/components/DataOverviewTable.tsx:162— DataOverviewTable.DataRow 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.
Logs.StateApiLogsFilesList (cyclomatic 16) python/ray/dashboard/client/src/pages/log/Logs.tsx:128— Logs.StateApiLogsFilesList has cyclomatic complexity 16 (threshold 15). Of this number, 11 points are the body's own statements and 5 belong to 2 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.
TaskPage.TaskPageContents (cyclomatic 16) python/ray/dashboard/client/src/pages/task/TaskPage.tsx:67— TaskPage.TaskPageContents 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.
D10 · Test Quality· Test project verifies nothing · ×1
Test project verifies nothing: the repository root python/ray/dashboard/tests/cypress/e2e/test_render.cy.js:2— No conventional assertion call was detected in 1 of 1 tests in `the repository root` — the project as a whole, not one method. Two things look like this: verification that happens indirectly (an approval/verifier harness or BDD step methods), or a suite that genuinely checks nothing. If it is the latter, this project passes unconditionally and cannot fail.
CompiledDAG._get_or_compile (cognitive 140) python/ray/dag/compiled_dag_node.py:1556— CompiledDAG._get_or_compile has cognitive complexity 140 (threshold 15). Drivers by points: if/else 31 (79 pts), loops 19 (45 pts), boolean chains 8, ternaries 2 (8 pts) (nesting depth added 80). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CompiledDAG._visualize_ascii (cognitive 125) python/ray/dag/compiled_dag_node.py:2684— CompiledDAG._visualize_ascii has cognitive complexity 125 (threshold 15). Drivers by points: if/else 29 (73 pts), loops 19 (36 pts), ternaries 3 (14 pts), boolean chains 2 (nesting depth added 72). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tune.run (cognitive 117) python/ray/tune/tune.py:267— tune.run has cognitive complexity 117 (threshold 15). Drivers by points: if/else 71 (92 pts), boolean chains 16, loops 5 (7 pts), error handling 2 (nesting depth added 23). 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.
AlgorithmConfig.get_multi_agent_setup (cognitive 115) python/ray/rllib/algorithms/algorithm_config.py:5849— AlgorithmConfig.get_multi_agent_setup has cognitive complexity 115 (threshold 15). Drivers by points: if/else 28 (75 pts), boolean chains 15, ternaries 4 (14 pts), loops 3 (11 pts) (nesting depth added 65). 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.
Learner._create_iterator_if_necessary (cognitive 109) python/ray/rllib/core/learner/learner.py:1259— Learner._create_iterator_if_necessary has cognitive complexity 109 (threshold 15). Drivers by points: if/else 25 (63 pts), ternaries 7 (23 pts), loops 4 (10 pts), boolean chains 9, error handling 1 (4 pts) (nesting depth added 63). 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.
ModelCatalog.get_model_v2 (cognitive 100) python/ray/rllib/models/catalog.py:334— ModelCatalog.get_model_v2 has cognitive complexity 100 (threshold 15). Drivers by points: if/else 32 (72 pts), boolean chains 9, ternaries 2 (8 pts), error handling 2 (7 pts), loops 1 (4 pts) (nesting depth added 54). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Node.__init__ (cognitive 96) REDACTED:85— Node.__init__ has cognitive complexity 96 (threshold 15). Drivers by points: if/else 46 (66 pts), boolean chains 17, error handling 2 (5 pts), loops 2 (4 pts), ternaries 2 (4 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
worker.init (cognitive 96) REDACTED:1447— worker.init has cognitive complexity 96 (threshold 15). Drivers by points: if/else 52 (72 pts), boolean chains 12, error handling 4 (7 pts), loops 3 (5 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.
CompiledDAG._preprocess (cognitive 85) python/ray/dag/compiled_dag_node.py:1088— CompiledDAG._preprocess has cognitive complexity 85 (threshold 15). Drivers by points: if/else 29 (70 pts), boolean chains 8, loops 5 (7 pts) (nesting depth added 43). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
application_state.override_deployment_info (cognitive 82) python/ray/serve/_private/application_state.py:1878— application_state.override_deployment_info has cognitive complexity 82 (threshold 15). Drivers by points: if/else 25 (62 pts), boolean chains 14, loops 3 (6 pts) (nesting depth added 40). 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.
Algorithm.setup (cognitive 79) REDACTED:729— Algorithm.setup has cognitive complexity 79 (threshold 15). Drivers by points: if/else 33 (57 pts), boolean chains 10, loops 4 (8 pts), ternaries 2 (4 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.
NodeUpdater.do_update (cognitive 77) python/ray/autoscaler/_private/updater.py:341— NodeUpdater.do_update has cognitive complexity 77 (threshold 15). Drivers by points: if/else 22 (52 pts), error handling 3 (12 pts), loops 3 (9 pts), boolean chains 4 (nesting depth added 45). 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.
streaming_executor_state.process_completed_tasks (cognitive 77) python/ray/data/_internal/execution/streaming_executor_state.py:794— streaming_executor_state.process_completed_tasks has cognitive complexity 77 (threshold 15). Drivers by points: if/else 12 (38 pts), loops 10 (17 pts), error handling 3 (16 pts), boolean chains 4, ternaries 1 (2 pts) (nesting depth added 47). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
scripts.start (cognitive 76) python/ray/scripts/scripts.py:801— scripts.start has cognitive complexity 76 (threshold 15). Drivers by points: if/else 28 (55 pts), error handling 4 (6 pts), ternaries 3 (6 pts), boolean chains 5, loops 2 (4 pts) (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
JobSubmitRequest.__post_init__ (cognitive 73) python/ray/dashboard/modules/job/common.py:481— JobSubmitRequest.__post_init__ has cognitive complexity 73 (threshold 15). Drivers by points: if/else 25 (50 pts), loops 6 (18 pts), boolean chains 5 (nesting depth added 37). To reduce it, split the body into named stages: move each independent 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_init._setup_ray_cluster_internal (cognitive 73) REDACTED:799— cluster_init._setup_ray_cluster_internal has cognitive complexity 73 (threshold 15). Drivers by points: if/else 45 (57 pts), boolean chains 10, error handling 3 (6 pts) (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.
download_stock_videos.download_sample_videos (cognitive 72) doc/source/serve/tutorials/video-analysis/scripts/download_stock_videos.py:320— download_stock_videos.download_sample_videos has cognitive complexity 72 (threshold 15). Drivers by points: if/else 22 (40 pts), loops 8 (14 pts), boolean chains 7, error handling 4 (7 pts), ternaries 4 (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.
DeploymentConfig.from_proto (cognitive 70) python/ray/serve/_private/config.py:463— DeploymentConfig.from_proto has cognitive complexity 70 (threshold 15). Drivers by points: if/else 34 (60 pts), boolean chains 6, loops 1 (2 pts), ternaries 2 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DynamicTFPolicy.__init__ (cognitive 69) python/ray/rllib/policy/dynamic_tf_policy.py:55— DynamicTFPolicy.__init__ has cognitive complexity 69 (threshold 15). Drivers by points: if/else 35 (54 pts), boolean chains 5, error handling 1 (4 pts), loops 1 (3 pts), ternaries 3 (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.
dag_node_operation._build_dag_node_operation_graph (cognitive 67) python/ray/dag/dag_node_operation.py:402— dag_node_operation._build_dag_node_operation_graph has cognitive complexity 67 (threshold 15). Drivers by points: if/else 9 (29 pts), loops 10 (25 pts), ternaries 2 (9 pts), boolean chains 4 (nesting depth added 42). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
from_config.from_config (cognitive 67) python/ray/rllib/utils/from_config.py:19— from_config.from_config has cognitive complexity 67 (threshold 15). Drivers by points: if/else 20 (40 pts), error handling 6 (18 pts), boolean chains 7, ternaries 1 (2 pts) (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.
rnn_sequencing.chop_into_sequences (cognitive 66) python/ray/rllib/policy/rnn_sequencing.py:268— rnn_sequencing.chop_into_sequences has cognitive complexity 66 (threshold 15). Drivers by points: if/else 15 (31 pts), loops 11 (30 pts), boolean chains 5 (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DeploymentState._check_startup_replicas (cognitive 65) python/ray/serve/_private/deployment_state.py:5023— DeploymentState._check_startup_replicas has cognitive complexity 65 (threshold 15). Drivers by points: if/else 19 (55 pts), loops 3 (6 pts), boolean chains 4 (nesting depth added 39). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ActorClass._remote (cognitive 64) python/ray/actor.py:1883— ActorClass._remote has cognitive complexity 64 (threshold 15). Drivers by points: if/else 34 (39 pts), boolean chains 11, error handling 3 (7 pts), ternaries 3 (4 pts), loops 3 (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.
Policy._initialize_loss_from_dummy_batch (cognitive 63) REDACTED:1302— Policy._initialize_loss_from_dummy_batch has cognitive complexity 63 (threshold 15). Drivers by points: if/else 22 (43 pts), loops 8 (14 pts), boolean chains 6 (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.
softwrap.reflow (cognitive 62) doc/.claude/skills/ray-soft-wrap/scripts/softwrap.py:132— softwrap.reflow has cognitive complexity 62 (threshold 15). Drivers by points: if/else 20 (44 pts), boolean chains 9, loops 4 (9 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.
ReporterAgent._to_records (cognitive 62) REDACTED:1624— ReporterAgent._to_records has cognitive complexity 62 (threshold 15). Drivers by points: if/else 20 (42 pts), loops 8 (16 pts), boolean chains 2, ternaries 2 (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.
Algorithm._evaluate_with_fixed_duration (cognitive 62) REDACTED:2086— Algorithm._evaluate_with_fixed_duration has cognitive complexity 62 (threshold 15). Drivers by points: if/else 15 (34 pts), ternaries 5 (19 pts), loops 3 (7 pts), boolean chains 2 (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout_ops.synchronous_parallel_sample (cognitive 62) python/ray/rllib/execution/rollout_ops.py:21— rollout_ops.synchronous_parallel_sample has cognitive complexity 62 (threshold 15). Drivers by points: if/else 17 (37 pts), ternaries 4 (14 pts), boolean chains 7, loops 2 (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.
AutoscalerEventLogger.log_cluster_scheduling_update (cognitive 61) python/ray/autoscaler/v2/event_logger.py:31— AutoscalerEventLogger.log_cluster_scheduling_update has cognitive complexity 61 (threshold 15). Drivers by points: loops 11 (29 pts), if/else 13 (28 pts), boolean chains 4 (nesting depth added 33). 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.
filter.filter_tests (cognitive 60) release/ray_release/buildkite/filter.py:22— filter.filter_tests has cognitive complexity 60 (threshold 15). Drivers by points: if/else 17 (48 pts), loops 3 (8 pts), boolean chains 4 (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.
_obstore_download._extract_credentials_from_filesystem (cognitive 60) python/ray/data/_internal/planner/_obstore_download.py:682— _obstore_download._extract_credentials_from_filesystem has cognitive complexity 60 (threshold 15). Drivers by points: if/else 22 (41 pts), boolean chains 14, ternaries 1 (3 pts), loops 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.
OperatorStatsSummary.from_block_metadata (cognitive 60) python/ray/data/_internal/stats.py:1774— OperatorStatsSummary.from_block_metadata has cognitive complexity 60 (threshold 15). Drivers by points: if/else 19 (41 pts), loops 5 (13 pts), boolean chains 3, ternaries 3 (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.
checkpoints.get_checkpoint_info (cognitive 58) REDACTED:729— checkpoints.get_checkpoint_info has cognitive complexity 58 (threshold 15). Drivers by points: if/else 14 (32 pts), loops 5 (12 pts), ternaries 2 (8 pts), boolean chains 6 (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.
AzureNodeProvider._delete_node_and_resources (cognitive 57) python/ray/autoscaler/_private/_azure/node_provider.py:555— AzureNodeProvider._delete_node_and_resources has cognitive complexity 57 (threshold 15). Drivers by points: if/else 8 (25 pts), loops 9 (16 pts), boolean chains 8, error handling 5 (8 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.
JobManager._monitor_job_internal (cognitive 57) python/ray/dashboard/modules/job/job_manager.py:152— JobManager._monitor_job_internal has cognitive complexity 57 (threshold 15). Drivers by points: if/else 21 (47 pts), boolean chains 7, error handling 1 (2 pts), loops 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.
ParquetFileReader._iter_fragment_tables_without_pickle_check (cognitive 57) python/ray/data/_internal/datasource_v2/formats/parquet/parquet_file_reader.py:441— ParquetFileReader._iter_fragment_tables_without_pickle_check has cognitive complexity 57 (threshold 15). Drivers by points: if/else 19 (35 pts), boolean chains 11, ternaries 6, loops 3 (5 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.
AlgorithmConfig.env_runners (cognitive 56) python/ray/rllib/algorithms/algorithm_config.py:1891— AlgorithmConfig.env_runners has cognitive complexity 56 (threshold 15). Drivers by points: if/else 51 (54 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.
SimpleListCollector.get_inference_input_dict (cognitive 56) python/ray/rllib/evaluation/collectors/simple_list_collector.py:317— SimpleListCollector.get_inference_input_dict has cognitive complexity 56 (threshold 15). Drivers by points: if/else 16 (34 pts), loops 6 (18 pts), ternaries 2 (3 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.
EnvRunnerV2._process_observations (cognitive 56) python/ray/rllib/evaluation/env_runner_v2.py:431— EnvRunnerV2._process_observations has cognitive complexity 56 (threshold 15). Drivers by points: if/else 16 (37 pts), loops 5 (11 pts), boolean chains 8 (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.
DynamicTFPolicy._initialize_loss_from_dummy_batch (cognitive 56) python/ray/rllib/policy/dynamic_tf_policy.py:718— DynamicTFPolicy._initialize_loss_from_dummy_batch has cognitive complexity 56 (threshold 15). Drivers by points: if/else 19 (41 pts), loops 6 (9 pts), boolean chains 5, 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.
DataServicer.Datapath (cognitive 56) python/ray/util/client/server/dataservicer.py:154— DataServicer.Datapath has cognitive complexity 56 (threshold 15). Drivers by points: if/else 25 (46 pts), boolean chains 5, loops 2 (4 pts), error handling 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.
DynamicTFPolicyV2._initialize_loss_from_dummy_batch (cognitive 54) python/ray/rllib/policy/dynamic_tf_policy_v2.py:676— DynamicTFPolicyV2._initialize_loss_from_dummy_batch has cognitive complexity 54 (threshold 15). Drivers by points: if/else 17 (39 pts), loops 6 (9 pts), boolean chains 5, 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.
DeploymentState._check_and_update_transitioning_replicas (cognitive 54) python/ray/serve/_private/deployment_state.py:5889— DeploymentState._check_and_update_transitioning_replicas has cognitive complexity 54 (threshold 15). Drivers by points: if/else 19 (44 pts), loops 4 (9 pts), boolean chains 1 (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.
config._configure_resource_group (cognitive 53) REDACTED:84— config._configure_resource_group has cognitive complexity 53 (threshold 15). Drivers by points: if/else 19 (35 pts), error handling 7 (16 pts), boolean chains 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.
kafka_datasource._validate_offsets (cognitive 53) python/ray/data/_internal/datasource/kafka_datasource.py:302— kafka_datasource._validate_offsets has cognitive complexity 53 (threshold 15). Drivers by points: if/else 14 (37 pts), loops 4 (10 pts), boolean chains 6 (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.
py_modules.upload_py_modules_if_needed (cognitive 52) python/ray/_private/runtime_env/py_modules.py:50— py_modules.upload_py_modules_if_needed has cognitive complexity 52 (threshold 15). Drivers by points: if/else 18 (41 pts), error handling 2 (9 pts), boolean chains 1, loops 1 (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.
CompiledDAG.visualize (cognitive 52) python/ray/dag/compiled_dag_node.py:3051— CompiledDAG.visualize has cognitive complexity 52 (threshold 15). Drivers by points: if/else 15 (32 pts), ternaries 3 (9 pts), loops 4 (8 pts), boolean chains 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.
RolloutWorker.__init__ (cognitive 52) REDACTED:216— RolloutWorker.__init__ has cognitive complexity 52 (threshold 15). Drivers by points: if/else 25 (32 pts), boolean chains 12, loops 3 (5 pts), ternaries 3 (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.
_CollectiveOperation.__init__ (cognitive 51) python/ray/dag/collective_node.py:41— _CollectiveOperation.__init__ has cognitive complexity 51 (threshold 15). Drivers by points: if/else 14 (30 pts), ternaries 5 (16 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.
VisionNetwork.__init__ (cognitive 51) python/ray/rllib/models/tf/visionnet.py:25— VisionNetwork.__init__ has cognitive complexity 51 (threshold 15). Drivers by points: ternaries 8 (20 pts), if/else 11 (17 pts), loops 5 (12 pts), boolean chains 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.
SampleBatch.slice (cognitive 51) python/ray/rllib/policy/sample_batch.py:616— SampleBatch.slice has cognitive complexity 51 (threshold 15). Drivers by points: if/else 13 (36 pts), loops 3 (11 pts), boolean chains 4 (nesting depth added 31). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
AgentCollector.add_action_reward_next_obs (cognitive 50) python/ray/rllib/evaluation/collectors/agent_collector.py:235— AgentCollector.add_action_reward_next_obs has cognitive complexity 50 (threshold 15). Drivers by points: if/else 17 (36 pts), loops 4 (9 pts), boolean chains 5 (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.
ApplicationState.apply_app_config (cognitive 50) python/ray/serve/_private/application_state.py:687— ApplicationState.apply_app_config has cognitive complexity 50 (threshold 15). Drivers by points: if/else 13 (37 pts), loops 2 (6 pts), error handling 2 (4 pts), boolean chains 3 (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.
metrics.summarize_episodes (cognitive 49) python/ray/rllib/evaluation/metrics.py:131— metrics.summarize_episodes has cognitive complexity 49 (threshold 15). Drivers by points: loops 13 (28 pts), if/else 13 (20 pts), boolean chains 1 (nesting depth added 22). 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.
AlgorithmConfig.offline_data (cognitive 48) python/ray/rllib/algorithms/algorithm_config.py:3310— AlgorithmConfig.offline_data has cognitive complexity 48 (threshold 15). Drivers by points: if/else 43 (48 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.
RayParams._check_usage (cognitive 47) python/ray/_private/parameter.py:352— RayParams._check_usage has cognitive complexity 47 (threshold 15). Drivers by points: if/else 19 (30 pts), boolean chains 10, error handling 2 (5 pts), 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.
dataset_repr.build_dataset_summary_repr (cognitive 47) python/ray/data/_internal/dataset_repr.py:349— dataset_repr.build_dataset_summary_repr has cognitive complexity 47 (threshold 15). Drivers by points: if/else 17 (33 pts), loops 3 (7 pts), ternaries 4 (6 pts), boolean chains 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AddStatesFromEpisodesToBatch.__call__ (cognitive 47) python/ray/rllib/connectors/common/add_states_from_episodes_to_batch.py:211— AddStatesFromEpisodesToBatch.__call__ has cognitive complexity 47 (threshold 15). Drivers by points: if/else 13 (28 pts), ternaries 4 (14 pts), boolean chains 4, loops 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OfflinePreLearner._map_sample_batch_to_episode (cognitive 47) python/ray/rllib/offline/offline_prelearner.py:423— OfflinePreLearner._map_sample_batch_to_episode has cognitive complexity 47 (threshold 15). Drivers by points: if/else 10 (21 pts), ternaries 6 (20 pts), boolean chains 5, loops 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
services.start_api_server (cognitive 46) python/ray/_private/services.py:1231— services.start_api_server has cognitive complexity 46 (threshold 15). Drivers by points: if/else 18 (24 pts), error handling 4 (10 pts), ternaries 5 (7 pts), boolean chains 4, 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.
worker.connect (cognitive 46) REDACTED:2510— worker.connect has cognitive complexity 46 (threshold 15). Drivers by points: if/else 27 (37 pts), boolean chains 6, error handling 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.
sdk.request_resources (cognitive 46) python/ray/autoscaler/sdk/sdk.py:215— sdk.request_resources has cognitive complexity 46 (threshold 15). Drivers by points: if/else 13 (33 pts), loops 3 (10 pts), boolean chains 3 (nesting depth added 27). 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.
memory_utils.memory_summary (cognitive 46) python/ray/dashboard/memory_utils.py:374— memory_utils.memory_summary has cognitive complexity 46 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 6 (12 pts), boolean chains 5, ternaries 2 (4 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.
MultiAgentPrioritizedEpisodeReplayBuffer.add (cognitive 46) python/ray/rllib/utils/replay_buffers/multi_agent_prioritized_episode_buffer.py:206— MultiAgentPrioritizedEpisodeReplayBuffer.add has cognitive complexity 46 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 9 (17 pts), ternaries 2 (9 pts), boolean chains 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RunnerGroup.sync_runner_states (cognitive 46) python/ray/rllib/utils/runners/runner_group.py:214— RunnerGroup.sync_runner_states has cognitive complexity 46 (threshold 15). Drivers by points: if/else 19 (35 pts), boolean chains 9, 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.
ProxyState._reconcile_internal (cognitive 46) python/ray/serve/_private/proxy_state.py:527— ProxyState._reconcile_internal has cognitive complexity 46 (threshold 15). Drivers by points: if/else 17 (43 pts), boolean chains 3 (nesting depth added 26). 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.
Deployment.options (cognitive 46) python/ray/serve/deployment.py:222— Deployment.options has cognitive complexity 46 (threshold 15). Drivers by points: if/else 38 (40 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.
worker._wait_generators_bulk (cognitive 45) REDACTED:3251— worker._wait_generators_bulk has cognitive complexity 45 (threshold 15). Drivers by points: if/else 18 (31 pts), loops 6 (8 pts), boolean chains 4, 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.
_obstore_download._download_uris_with_obstore (cognitive 45) python/ray/data/_internal/planner/_obstore_download.py:1210— _obstore_download._download_uris_with_obstore has cognitive complexity 45 (threshold 15). Drivers by points: if/else 17 (31 pts), loops 4 (6 pts), boolean chains 4, ternaries 2 (4 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.
jax_util._yield_batches_with_sync (cognitive 45) python/ray/data/util/jax_util.py:255— jax_util._yield_batches_with_sync has cognitive complexity 45 (threshold 15). Drivers by points: if/else 14 (42 pts), loops 2 (3 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.
Algorithm._checkpoint_info_to_algorithm_state (cognitive 45) REDACTED:4323— Algorithm._checkpoint_info_to_algorithm_state has cognitive complexity 45 (threshold 15). Drivers by points: if/else 19 (33 pts), ternaries 3 (7 pts), boolean chains 3, 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.
AlgorithmConfig.get_multi_rl_module_spec (cognitive 45) python/ray/rllib/algorithms/algorithm_config.py:4781— AlgorithmConfig.get_multi_rl_module_spec has cognitive complexity 45 (threshold 15). Drivers by points: if/else 19 (39 pts), boolean chains 5, loops 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.
_CliLogger.confirm (cognitive 44) python/ray/autoscaler/_private/cli_logger.py:591— _CliLogger.confirm has cognitive complexity 44 (threshold 15). Drivers by points: if/else 18 (36 pts), loops 2 (4 pts), boolean chains 3, 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.
ReporterAgent._async_get_workers_and_agents (cognitive 44) REDACTED:1157— ReporterAgent._async_get_workers_and_agents has cognitive complexity 44 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 7 (20 pts), error handling 1 (3 pts), boolean chains 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.
FileReader.read (cognitive 44) python/ray/data/_internal/datasource_v2/common/file_reader.py:186— FileReader.read has cognitive complexity 44 (threshold 15). Drivers by points: if/else 15 (34 pts), loops 3 (5 pts), boolean chains 4, ternaries 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
read_api.read_parquet (cognitive 44) python/ray/data/read_api.py:1667— read_api.read_parquet has cognitive complexity 44 (threshold 15). Drivers by points: if/else 18 (36 pts), boolean chains 6, ternaries 1 (2 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Stats.__init__ (cognitive 44) python/ray/rllib/utils/metrics/legacy_stats.py:45— Stats.__init__ has cognitive complexity 44 (threshold 15). Drivers by points: if/else 21 (36 pts), boolean chains 6, 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.
grafana_dashboard_factory._generate_panel_template (cognitive 43) python/ray/dashboard/modules/metrics/grafana_dashboard_factory.py:234— grafana_dashboard_factory._generate_panel_template has cognitive complexity 43 (threshold 15). Drivers by points: if/else 28 (42 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.
AddTimeDimToBatchAndZeroPad.__call__ (cognitive 43) python/ray/rllib/connectors/common/add_time_dim_to_batch_and_zero_pad.py:182— AddTimeDimToBatchAndZeroPad.__call__ has cognitive complexity 43 (threshold 15). Drivers by points: if/else 10 (25 pts), loops 4 (9 pts), ternaries 2 (8 pts), boolean chains 1 (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.
ZarrV2Datasource.__init__ (cognitive 42) python/ray/data/_internal/datasource/zarrv2_datasource.py:277— ZarrV2Datasource.__init__ has cognitive complexity 42 (threshold 15). Drivers by points: if/else 24 (34 pts), boolean chains 6, 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.
UnBatchToIndividualItems.__call__ (cognitive 42) python/ray/rllib/connectors/module_to_env/unbatch_to_individual_items.py:39— UnBatchToIndividualItems.__call__ has cognitive complexity 42 (threshold 15). Drivers by points: if/else 7 (26 pts), loops 5 (14 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.
Node._kill_process_impl (cognitive 41) REDACTED:1868— Node._kill_process_impl has cognitive complexity 41 (threshold 15). Drivers by points: if/else 13 (31 pts), error handling 2 (6 pts), ternaries 1 (3 pts), 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.
AlgorithmConfig.evaluation (cognitive 41) python/ray/rllib/algorithms/algorithm_config.py:2914— AlgorithmConfig.evaluation has cognitive complexity 41 (threshold 15). Drivers by points: if/else 39 (40 pts), boolean chains 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.
AlgorithmConfig.multi_agent (cognitive 41) python/ray/rllib/algorithms/algorithm_config.py:3695— AlgorithmConfig.multi_agent has cognitive complexity 41 (threshold 15). Drivers by points: if/else 19 (33 pts), loops 2 (5 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.
SimpleListCollector.postprocess_episode (cognitive 41) python/ray/rllib/evaluation/collectors/simple_list_collector.py:420— SimpleListCollector.postprocess_episode has cognitive complexity 41 (threshold 15). Drivers by points: if/else 19 (31 pts), loops 5 (7 pts), boolean chains 3 (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.
TFMultiGPUTowerStack.__init__ (cognitive 41) python/ray/rllib/policy/dynamic_tf_policy.py:945— TFMultiGPUTowerStack.__init__ has cognitive complexity 41 (threshold 15). Drivers by points: loops 10 (24 pts), if/else 9 (15 pts), boolean chains 2 (nesting depth added 20). 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.
Stats._reduced_values (cognitive 41) python/ray/rllib/utils/metrics/legacy_stats.py:821— Stats._reduced_values has cognitive complexity 41 (threshold 15). Drivers by points: if/else 19 (34 pts), boolean chains 4, loops 1 (2 pts), 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.
sphinx_fix.render_human (cognitive 40) doc/.claude/skills/sphinx-fix/sphinx_fix.py:791— sphinx_fix.render_human has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (16 pts), loops 8 (14 pts), ternaries 5 (10 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.
services.start_raylet (cognitive 40) python/ray/_private/services.py:1610— services.start_raylet has cognitive complexity 40 (threshold 15). Drivers by points: if/else 31, boolean chains 5, ternaries 3, error handling 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
StandardAutoscaler.process_completed_updates (cognitive 40) python/ray/autoscaler/_private/autoscaler.py:776— StandardAutoscaler.process_completed_updates has cognitive complexity 40 (threshold 15). Drivers by points: if/else 11 (30 pts), loops 3 (6 pts), error handling 1 (4 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.
BatchIndividualItems.__call__ (cognitive 40) python/ray/rllib/connectors/common/batch_individual_items.py:132— BatchIndividualItems.__call__ has cognitive complexity 40 (threshold 15). Drivers by points: if/else 7 (23 pts), ternaries 2 (8 pts), loops 3 (7 pts), boolean chains 2 (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.
OfflinePreLearner._map_to_episodes (cognitive 40) python/ray/rllib/offline/offline_prelearner.py:322— OfflinePreLearner._map_to_episodes has cognitive complexity 40 (threshold 15). Drivers by points: ternaries 8 (25 pts), if/else 6 (13 pts), boolean chains 1, 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.
rnn_sequencing.timeslice_along_seq_lens_with_overlap (cognitive 40) python/ray/rllib/policy/rnn_sequencing.py:463— rnn_sequencing.timeslice_along_seq_lens_with_overlap has cognitive complexity 40 (threshold 15). Drivers by points: if/else 13 (23 pts), loops 5 (10 pts), ternaries 2 (5 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.
ServeEntityLogViewer.ServeEntityLogViewer (cognitive 40) python/ray/dashboard/client/src/pages/serve/ServeEntityLogViewer.tsx:32— ServeEntityLogViewer.ServeEntityLogViewer has cognitive complexity 40 (threshold 15). Drivers by points: boolean chains 19, ternaries 9 (14 pts), if/else 7 (nesting depth added 5). Of this number, 26 points are the body's own statements and 14 belong to 3 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.
clang-tidy-diff.main (cognitive 39) ci/lint/clang-tidy-diff.py:113— clang-tidy-diff.main has cognitive complexity 39 (threshold 15). Drivers by points: if/else 19 (30 pts), loops 4, boolean chains 3, error handling 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.
MultiAgentEpisodeReplayBuffer._sample_synchonized (cognitive 39) python/ray/rllib/utils/replay_buffers/multi_agent_episode_buffer.py:857— MultiAgentEpisodeReplayBuffer._sample_synchonized has cognitive complexity 39 (threshold 15). Drivers by points: if/else 15 (29 pts), boolean chains 7, 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.
DeploymentState._stop_or_update_outdated_version_replicas (cognitive 39) python/ray/serve/_private/deployment_state.py:4268— DeploymentState._stop_or_update_outdated_version_replicas has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (22 pts), loops 6 (17 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.
commands.get_or_create_head_node (cognitive 38) python/ray/autoscaler/_private/commands.py:709— commands.get_or_create_head_node has cognitive complexity 38 (threshold 15). Drivers by points: if/else 23 (31 pts), boolean chains 3, error handling 1 (2 pts), loops 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ResourceDemandScheduler._try_schedule (cognitive 38) python/ray/autoscaler/v2/scheduler.py:1722— ResourceDemandScheduler._try_schedule has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (24 pts), loops 8, boolean chains 6 (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.
_AutoscalingCoordinatorActor._refresh_resource_reservations (cognitive 38) python/ray/data/_internal/cluster_autoscaler/default_autoscaling_coordinator.py:629— _AutoscalingCoordinatorActor._refresh_resource_reservations has cognitive complexity 38 (threshold 15). Drivers by points: if/else 9 (23 pts), loops 7 (15 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.
Algorithm.evaluate (cognitive 38) REDACTED:1392— Algorithm.evaluate has cognitive complexity 38 (threshold 15). Drivers by points: if/else 19 (27 pts), loops 3 (8 pts), boolean chains 3 (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.
AgentCollector.build_for_training (cognitive 38) python/ray/rllib/evaluation/collectors/agent_collector.py:396— AgentCollector.build_for_training has cognitive complexity 38 (threshold 15). Drivers by points: if/else 9 (21 pts), loops 5 (13 pts), boolean chains 2, ternaries 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.
DeploymentStateManager.update (cognitive 38) python/ray/serve/_private/deployment_state.py:7280— DeploymentStateManager.update has cognitive complexity 38 (threshold 15). Drivers by points: if/else 12 (21 pts), loops 11, boolean chains 6 (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.
RequestRouter._fulfill_pending_requests (cognitive 38) python/ray/serve/_private/request_router/request_router.py:1267— RequestRouter._fulfill_pending_requests has cognitive complexity 38 (threshold 15). Drivers by points: if/else 9 (27 pts), loops 4 (7 pts), boolean chains 3, 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.
common.protobuf_to_task_state_dict (cognitive 38) python/ray/util/state/common.py:1625— common.protobuf_to_task_state_dict has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (27 pts), loops 5 (9 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.
SlicePlacementGroup._reserve_slice (cognitive 38) python/ray/util/tpu.py:633— SlicePlacementGroup._reserve_slice has cognitive complexity 38 (threshold 15). Drivers by points: if/else 9 (19 pts), ternaries 3 (10 pts), loops 3 (6 pts), boolean chains 2, 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.
util.format_info_string (cognitive 37) python/ray/autoscaler/_private/util.py:853— util.format_info_string has cognitive complexity 37 (threshold 15). Drivers by points: if/else 20 (28 pts), loops 6 (9 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.
NixlTensorTransport.extract_tensor_transport_metadata (cognitive 37) python/ray/experimental/rdt/nixl_tensor_transport.py:278— NixlTensorTransport.extract_tensor_transport_metadata has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 3 (10 pts), ternaries 2 (3 pts), boolean chains 2 (nesting depth added 20). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Replica._direct_ingress_asgi (cognitive 37) REDACTED:3122— Replica._direct_ingress_asgi has cognitive complexity 37 (threshold 15). Drivers by points: if/else 16 (22 pts), loops 4 (7 pts), boolean chains 6, 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.
RayConfig.<init> (cognitive 37) java/runtime/src/main/java/io/ray/runtime/config/RayConfig.java:102— RayConfig.<init> has cognitive complexity 37 (threshold 15). Drivers by points: if/else 26 (27 pts), ternaries 4 (7 pts), boolean chains 1, 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.
run_docstring_examples.main (cognitive 36) ci/ray_ci/doc/run_docstring_examples.py:319— run_docstring_examples.main has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (21 pts), loops 4 (6 pts), error handling 2 (5 pts), ternaries 2 (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.
DataOpTask.on_data_ready (cognitive 36) REDACTED:252— DataOpTask.on_data_ready has cognitive complexity 36 (threshold 15). Drivers by points: if/else 8 (19 pts), error handling 3 (10 pts), boolean chains 3, ternaries 1 (3 pts), loops 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.
DatasetStatsSummary.to_string (cognitive 36) python/ray/data/_internal/stats.py:1495— DatasetStatsSummary.to_string has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (24 pts), boolean chains 6, loops 2 (4 pts), ternaries 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.
IterStatsSummary.to_string (cognitive 36) python/ray/data/_internal/stats.py:2147— IterStatsSummary.to_string has cognitive complexity 36 (threshold 15). Drivers by points: if/else 19 (33 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ConnectorV2.single_agent_episode_iterator (cognitive 36) python/ray/rllib/connectors/connector_v2.py:275— ConnectorV2.single_agent_episode_iterator has cognitive complexity 36 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 5 (14 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rnn_sequencing.pad_batch_to_sequences_of_same_size (cognitive 36) python/ray/rllib/policy/rnn_sequencing.py:35— rnn_sequencing.pad_batch_to_sequences_of_same_size has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (22 pts), boolean chains 9, loops 3, 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.
DeploymentState.migrate_replicas_on_draining_nodes (cognitive 36) python/ray/serve/_private/deployment_state.py:6190— DeploymentState.migrate_replicas_on_draining_nodes has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (23 pts), loops 6 (8 pts), boolean chains 4, ternaries 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.
HAProxyManager.serving (cognitive 36) REDACTED:2026— HAProxyManager.serving has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (26 pts), loops 3 (6 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.
PopulationBasedTraining.on_trial_result (cognitive 36) python/ray/tune/schedulers/pbt.py:526— PopulationBasedTraining.on_trial_result has cognitive complexity 36 (threshold 15). Drivers by points: if/else 13 (21 pts), loops 3 (8 pts), ternaries 2 (4 pts), boolean chains 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.
ParallelActorCallGenerator.buildCalls (cognitive 36) java/runtime/src/main/java/io/ray/runtime/util/generator/ParallelActorCallGenerator.java:104— ParallelActorCallGenerator.buildCalls has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (18 pts), ternaries 9 (14 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.
ReportHead.memory_profile (cognitive 35) python/ray/dashboard/modules/reporter/reporter_head.py:939— ReportHead.memory_profile has cognitive complexity 35 (threshold 15). Drivers by points: if/else 15 (26 pts), error handling 3 (6 pts), ternaries 2, 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.
ConnectorV2.foreach_batch_item_change_in_place (cognitive 35) python/ray/rllib/connectors/connector_v2.py:734— ConnectorV2.foreach_batch_item_change_in_place has cognitive complexity 35 (threshold 15). Drivers by points: loops 5 (14 pts), ternaries 4 (14 pts), if/else 5 (7 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.
TorchLearner.apply_gradients (cognitive 35) python/ray/rllib/core/learner/torch/torch_learner.py:200— TorchLearner.apply_gradients has cognitive complexity 35 (threshold 15). Drivers by points: if/else 8 (22 pts), loops 4 (9 pts), boolean chains 4 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Checkpointable.save_to_path (cognitive 35) REDACTED:95— Checkpointable.save_to_path has cognitive complexity 35 (threshold 15). Drivers by points: if/else 15 (28 pts), boolean chains 4, ternaries 2, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MultiAgentPrioritizedReplayBuffer._add_to_underlying_buffer (cognitive 35) python/ray/rllib/utils/replay_buffers/multi_agent_prioritized_replay_buffer.py:149— MultiAgentPrioritizedReplayBuffer._add_to_underlying_buffer has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (26 pts), boolean chains 4, loops 2 (3 pts), 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.
setup-dev.do_link (cognitive 35) REDACTED:27— setup-dev.do_link has cognitive complexity 35 (threshold 15). Drivers by points: if/else 16 (26 pts), boolean chains 5, error handling 2 (4 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.
scheduler.ray_dask_get (cognitive 35) python/ray/util/dask/scheduler.py:93— scheduler.ray_dask_get has cognitive complexity 35 (threshold 15). Drivers by points: if/else 16 (23 pts), loops 4 (10 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.
ResultThread.run (cognitive 35) python/ray/util/multiprocessing/pool.py:233— ResultThread.run has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 3 (6 pts), error handling 2 (5 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.
RayCallGenerator.buildCalls (cognitive 35) java/runtime/src/main/java/io/ray/runtime/util/generator/RayCallGenerator.java:166— RayCallGenerator.buildCalls has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (17 pts), ternaries 9 (14 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.
validation.parse_and_validate_uv (cognitive 34) python/ray/_private/runtime_env/validation.py:165— validation.parse_and_validate_uv has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (26 pts), loops 2 (5 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.
TorchMLP.__init__ (cognitive 34) python/ray/rllib/core/models/torch/primitives.py:27— TorchMLP.__init__ has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (24 pts), boolean chains 6, ternaries 2 (3 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.
ModelCatalog.get_action_dist (cognitive 34) python/ray/rllib/models/catalog.py:142— ModelCatalog.get_action_dist has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 6 (17 pts), if/else 8 (14 pts), boolean chains 3 (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.
json_reader.postprocess_actions (cognitive 34) python/ray/rllib/offline/json_reader.py:105— json_reader.postprocess_actions has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (25 pts), loops 2 (6 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.
TorchPolicy.__init__ (cognitive 34) python/ray/rllib/policy/torch_policy.py:64— TorchPolicy.__init__ has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (19 pts), loops 4 (8 pts), boolean chains 4, 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.
Stats.merge_in_parallel (cognitive 34) python/ray/rllib/utils/metrics/legacy_stats.py:458— Stats.merge_in_parallel has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (26 pts), loops 2 (5 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.
TensorFlowVariables.__init__ (cognitive 34) python/ray/rllib/utils/tf_utils.py:843— TensorFlowVariables.__init__ has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 6 (11 pts), ternaries 2 (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.
DeploymentConfig.to_proto (cognitive 34) python/ray/serve/_private/config.py:356— DeploymentConfig.to_proto has cognitive complexity 34 (threshold 15). Drivers by points: if/else 18 (29 pts), boolean chains 3, 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.
DeploymentState.check_and_update_replicas (cognitive 34) python/ray/serve/_private/deployment_state.py:5668— DeploymentState.check_and_update_replicas has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (24 pts), loops 5 (9 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.
TaskExecutor.execute (cognitive 34) java/runtime/src/main/java/io/ray/runtime/task/TaskExecutor.java:98— TaskExecutor.execute has cognitive complexity 34 (threshold 15). Drivers by points: if/else 16 (22 pts), error handling 3 (6 pts), ternaries 2 (3 pts), boolean chains 2, 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.
ActorTable.ActorTable (cognitive 34) python/ray/dashboard/client/src/components/ActorTable.tsx:86— ActorTable.ActorTable has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 18, boolean chains 14, if/else 2. Most of this is not in the body itself: 3 of the 34 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 613, 120, 591, …). 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.
worker.get (cognitive 33) REDACTED:2900— worker.get has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (24 pts), boolean chains 4, loops 2 (3 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.
ReporterAgent._get_tpu_usage (cognitive 33) REDACTED:865— ReporterAgent._get_tpu_usage has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (22 pts), loops 4 (6 pts), match/switch 1 (3 pts), error handling 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.
utils.update_priorities_in_replay_buffer (cognitive 33) python/ray/rllib/utils/replay_buffers/utils.py:71— utils.update_priorities_in_replay_buffer has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (26 pts), loops 2 (6 pts), boolean chains 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
scripts.run (cognitive 33) python/ray/serve/scripts.py:461— scripts.run has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (19 pts), error handling 3 (6 pts), loops 2 (5 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.
HyperBandForBOHB.choose_trial_to_run (cognitive 33) python/ray/tune/schedulers/hb_bohb.py:127— HyperBandForBOHB.choose_trial_to_run has cognitive complexity 33 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 5 (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.
tpu.run_on_slice (cognitive 33) python/ray/util/tpu.py:962— tpu.run_on_slice has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (21 pts), loops 3 (7 pts), boolean chains 3, error handling 1, ternaries 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
setup.build (cognitive 33) python/setup.py:467— setup.build has cognitive complexity 33 (threshold 15). Drivers by points: if/else 22 (28 pts), loops 2 (3 pts), boolean chains 2 (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.
packaging.unzip_package (cognitive 32) REDACTED:1121— packaging.unzip_package has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (27 pts), error handling 2 (3 pts), boolean chains 1, 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.
working_dir.upload_working_dir_if_needed (cognitive 32) python/ray/_private/runtime_env/working_dir.py:41— working_dir.upload_working_dir_if_needed has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (18 pts), error handling 4 (7 pts), boolean chains 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.
RemoteFunction._remote (cognitive 32) python/ray/remote_function.py:358— RemoteFunction._remote has cognitive complexity 32 (threshold 15). Drivers by points: if/else 21 (26 pts), boolean chains 3, ternaries 2, loops 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
AlgorithmConfig.get_rl_module_spec (cognitive 32) python/ray/rllib/algorithms/algorithm_config.py:4690— AlgorithmConfig.get_rl_module_spec has cognitive complexity 32 (threshold 15). Drivers by points: if/else 15 (27 pts), loops 1 (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.
AlgorithmConfig._validate_to_be_deprecated_settings (cognitive 32) python/ray/rllib/algorithms/algorithm_config.py:5422— AlgorithmConfig._validate_to_be_deprecated_settings has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 6, ternaries 2 (6 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.
VisionNetwork.__init__ (cognitive 32) python/ray/rllib/models/torch/visionnet.py:25— VisionNetwork.__init__ has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (13 pts), loops 4 (9 pts), ternaries 3 (9 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.
MetricsLogger._maybe_create_stats_object (cognitive 32) python/ray/rllib/utils/metrics/metrics_logger.py:265— MetricsLogger._maybe_create_stats_object has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (26 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.
RuntimeEnv.__init__ (cognitive 32) python/ray/runtime_env/runtime_env.py:333— RuntimeEnv.__init__ has cognitive complexity 32 (threshold 15). Drivers by points: if/else 25 (30 pts), boolean chains 1, loops 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
symmetric_run.symmetric_run (cognitive 32) python/ray/scripts/symmetric_run.py:139— symmetric_run.symmetric_run has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (21 pts), error handling 4, boolean chains 3, 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.
DeploymentScheduler._find_best_node_to_compact (cognitive 32) python/ray/serve/_private/deployment_scheduler.py:1722— DeploymentScheduler._find_best_node_to_compact has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 4 (7 pts), boolean chains 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.
_anyscale_job_wrapper.main (cognitive 31) release/ray_release/command_runner/_anyscale_job_wrapper.py:504— _anyscale_job_wrapper.main has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (23 pts), boolean chains 6, 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.
config._configure_key_pair (cognitive 31) python/ray/autoscaler/_private/gcp/config.py:482— config._configure_key_pair has cognitive complexity 31 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 3 (6 pts), error handling 1 (4 pts), boolean chains 3, 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.
subprocess_output_util._read_subprocess_stream (cognitive 31) python/ray/autoscaler/_private/subprocess_output_util.py:80— subprocess_output_util._read_subprocess_stream has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (28 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.
format_utils._get_kwargs_lines (cognitive 31) python/ray/dag/format_utils.py:65— format_utils._get_kwargs_lines has cognitive complexity 31 (threshold 15). Drivers by points: loops 7 (20 pts), if/else 7 (11 pts) (nesting depth added 17). 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.
iter_batches.prefetch_batches_locally (cognitive 31) python/ray/data/_internal/block_batching/iter_batches.py:454— iter_batches.prefetch_batches_locally has cognitive complexity 31 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 5 (10 pts), boolean chains 6, error handling 2 (5 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.
pandas_block._reconcile_arrow_backed_int_float_columns (cognitive 31) python/ray/data/_internal/pandas_block.py:68— pandas_block._reconcile_arrow_backed_int_float_columns has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (23 pts), loops 4 (5 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Algorithm._evaluate_with_auto_duration (cognitive 31) REDACTED:1830— Algorithm._evaluate_with_auto_duration has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 3 (7 pts), boolean chains 3 (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.
AgentToModuleMapping.__call__ (cognitive 31) python/ray/rllib/connectors/common/agent_to_module_mapping.py:166— AgentToModuleMapping.__call__ has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 5 (9 pts), boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Experiment.__init__ (cognitive 31) python/ray/tune/experiment/experiment.py:102— Experiment.__init__ has cognitive complexity 31 (threshold 15). Drivers by points: if/else 18 (25 pts), boolean chains 4, error handling 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.
TBXLoggerCallback.log_trial_result (cognitive 31) python/ray/tune/logger/tensorboardx.py:57— TBXLoggerCallback.log_trial_result has cognitive complexity 31 (threshold 15). Drivers by points: if/else 7 (18 pts), boolean chains 8, error handling 1 (3 pts), loops 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.
tpu._get_intact_tpu_slices (cognitive 31) python/ray/util/tpu.py:310— tpu._get_intact_tpu_slices has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (23 pts), boolean chains 5, loops 2, 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.
LogVirtualView.LogVirtualView (cognitive 31) python/ray/dashboard/client/src/components/LogView/LogVirtualView.tsx:197— LogVirtualView.LogVirtualView has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 8, error handling 1, ternaries 1 (nesting depth added 9). Most of this is not in the body itself: 4 of the 31 points are its own statements and the rest belongs to 8 function items inside it that branch (itemRenderer, a function literal at line 362, a function literal at line 317, …). 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.
App.App (cognitive 31) python/ray/dashboard/client/src/App.tsx:162— App.App has cognitive complexity 31 (threshold 15). Drivers by points: boolean chains 11, if/else 11, error handling 4 (5 pts), ternaries 3 (4 pts) (nesting depth added 2). Most of this is not in the body itself: 1 of the 31 points is its own statement and the rest belongs to 9 function items inside it that branch (a function literal at line 164, a function literal at line 249, a function literal at line 357, …). 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.
api_param_coverage.build_class_index (cognitive 30) ci/ray_ci/doc/api_param_coverage.py:211— api_param_coverage.build_class_index has cognitive complexity 30 (threshold 15). Drivers by points: if/else 5 (19 pts), loops 4 (9 pts), error handling 1 (2 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.
api_param_coverage.public_callables (cognitive 30) ci/ray_ci/doc/api_param_coverage.py:292— api_param_coverage.public_callables has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (23 pts), loops 2 (4 pts), boolean chains 2, 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.
softwrap.main (cognitive 30) doc/.claude/skills/ray-soft-wrap/scripts/softwrap.py:409— softwrap.main has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (19 pts), ternaries 2 (7 pts), boolean chains 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.
services.start_ray_process (cognitive 30) python/ray/_private/services.py:883— services.start_ray_process has cognitive complexity 30 (threshold 15). Drivers by points: if/else 20 (22 pts), ternaries 4 (5 pts), error handling 1 (2 pts), boolean chains 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.
Worker.get_objects (cognitive 30) REDACTED:965— Worker.get_objects has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 3 (4 pts), boolean chains 3, ternaries 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.
AliyunNodeProvider.create_node (cognitive 30) python/ray/autoscaler/_private/aliyun/node_provider.py:206— AliyunNodeProvider.create_node has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 3 (11 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.
Monitor._run (cognitive 30) python/ray/autoscaler/_private/monitor.py:373— Monitor._run has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 3 (8 pts), error handling 2 (5 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.
scheduling_overhead.collect_scheduling_overhead (cognitive 30) python/ray/data/_internal/scheduling_overhead.py:172— scheduling_overhead.collect_scheduling_overhead has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 7 (12 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.
util.get_compute_strategy (cognitive 30) python/ray/data/_internal/util.py:597— util.get_compute_strategy has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 5 (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.
DataType.from_dtype (cognitive 30) python/ray/data/datatype.py:411— DataType.from_dtype has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (19 pts), error handling 6 (10 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.
AlgorithmConfig.build_env_to_module_connector (cognitive 30) python/ray/rllib/algorithms/algorithm_config.py:1021— AlgorithmConfig.build_env_to_module_connector has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 4, ternaries 1 (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.
Policy._update_model_view_requirements_from_init_state (cognitive 30) REDACTED:1577— Policy._update_model_view_requirements_from_init_state has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (14 pts), ternaries 4 (8 pts), boolean chains 5, 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.
TorchPolicyV2.__init__ (cognitive 30) python/ray/rllib/policy/torch_policy_v2.py:66— TorchPolicyV2.__init__ has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 5 (10 pts), boolean chains 3, ternaries 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.
numpy.flatten_inputs_to_1d_tensor (cognitive 30) python/ray/rllib/utils/numpy.py:205— numpy.flatten_inputs_to_1d_tensor has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (26 pts), boolean chains 2, loops 1, ternaries 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.
space_utils.get_dummy_batch_for_space (cognitive 30) python/ray/rllib/utils/spaces/space_utils.py:141— space_utils.get_dummy_batch_for_space has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (22 pts), ternaries 2 (6 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.
ActorReplicaWrapper.check_ready (cognitive 30) python/ray/serve/_private/deployment_state.py:1556— ActorReplicaWrapper.check_ready has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (17 pts), error handling 6 (12 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.
Autodoc._get_autodoc_rsts_in_file (cognitive 29) ci/ray_ci/doc/autodoc.py:104— Autodoc._get_autodoc_rsts_in_file has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
usage_lib.get_cluster_config_to_report (cognitive 29) python/ray/_common/usage/usage_lib.py:751— usage_lib.get_cluster_config_to_report has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (24 pts), boolean chains 2, error handling 2, 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.
validation.parse_and_validate_pip (cognitive 29) python/ray/_private/runtime_env/validation.py:269— validation.parse_and_validate_pip has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (24 pts), loops 1 (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.
config._configure_key_pair (cognitive 29) python/ray/autoscaler/_private/aws/config.py:354— config._configure_key_pair has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 5 (7 pts), ternaries 1 (4 pts), error handling 1 (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.
DockerCommandRunner.run_init (cognitive 29) python/ray/autoscaler/_private/command_runner.py:762— DockerCommandRunner.run_init has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (16 pts), error handling 2 (5 pts), loops 3 (4 pts), ternaries 2 (3 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ResourceDemandScheduler._enforce_idle_termination (cognitive 29) python/ray/autoscaler/v2/scheduler.py:2229— ResourceDemandScheduler._enforce_idle_termination has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (26 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NvidiaGpuProvider._get_gpu_info (cognitive 29) python/ray/dashboard/modules/reporter/gpu_providers.py:412— NvidiaGpuProvider._get_gpu_info has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (16 pts), error handling 6 (7 pts), loops 2 (3 pts), 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.
state_api_utils.do_filter (cognitive 29) python/ray/dashboard/state_api_utils.py:198— state_api_utils.do_filter has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (22 pts), boolean chains 4, 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.
ClickHouseDatasink.on_write_start (cognitive 29) python/ray/data/_internal/datasource/clickhouse_datasink.py:307— ClickHouseDatasink.on_write_start has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 5, 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.
PrepareMultimodalUDF._extract_system_messages (cognitive 29) python/ray/llm/_internal/batch/stages/prepare_multimodal_stage.py:49— PrepareMultimodalUDF._extract_system_messages has cognitive complexity 29 (threshold 15). Drivers by points: if/else 5 (17 pts), loops 2 (5 pts), ternaries 1 (4 pts), boolean chains 3 (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.
S3FileSystem.download_files (cognitive 29) python/ray/llm/_internal/common/utils/cloud_filesystem/s3_filesystem.py:230— S3FileSystem.download_files has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 3 (4 pts), boolean chains 1, 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.
AlgorithmConfig.update_from_dict (cognitive 29) python/ray/rllib/algorithms/algorithm_config.py:751— AlgorithmConfig.update_from_dict has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (24 pts), boolean chains 4, 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.
AlgorithmConfig._validate_offline_settings (cognitive 29) python/ray/rllib/algorithms/algorithm_config.py:5526— AlgorithmConfig._validate_offline_settings has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 13 (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.
AgentToModuleMapping._map_space_if_necessary (cognitive 29) python/ray/rllib/connectors/common/agent_to_module_mapping.py:237— AgentToModuleMapping._map_space_if_necessary has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (21 pts), boolean chains 4, loops 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.
sample_batch.concat_samples (cognitive 29) python/ray/rllib/policy/sample_batch.py:1606— sample_batch.concat_samples has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 7, 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.
EpisodeReplayBuffer.add (cognitive 29) python/ray/rllib/utils/replay_buffers/episode_replay_buffer.py:187— EpisodeReplayBuffer.add has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (21 pts), loops 3 (6 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.
HTTPProxy.send_request_to_replica (cognitive 29) REDACTED:1280— HTTPProxy.send_request_to_replica has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (20 pts), loops 3 (5 pts), boolean chains 2, error handling 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.
pbt._explore (cognitive 29) python/ray/tune/schedulers/pbt.py:66— pbt._explore has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (15 pts), ternaries 3 (12 pts), boolean chains 1, 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.
scheduler_utils.get_async (cognitive 29) python/ray/util/dask/scheduler_utils.py:242— scheduler_utils.get_async has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 7 (9 pts), boolean chains 4 (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.
Node._init_gcs_client (cognitive 28) REDACTED:965— Node._init_gcs_client has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (15 pts), ternaries 2 (6 pts), error handling 2 (4 pts), boolean chains 2, 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.
services.get_node_to_connect_for_driver (cognitive 28) python/ray/_private/services.py:512— services.get_node_to_connect_for_driver has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 4 (6 pts), boolean chains 5, 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.
DefaultActorAutoscaler._derive_target_scaling_config (cognitive 28) python/ray/data/_internal/actor_autoscaler/default_actor_autoscaler.py:52— DefaultActorAutoscaler._derive_target_scaling_config has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (23 pts), boolean chains 3, 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.
KafkaDatasource.get_read_tasks (cognitive 28) python/ray/data/_internal/datasource/kafka_datasource.py:559— KafkaDatasource.get_read_tasks has cognitive complexity 28 (threshold 15). Drivers by points: loops 7 (13 pts), if/else 4 (11 pts), 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.
OrcFileReader._iter_fragment_tables (cognitive 28) python/ray/data/_internal/datasource_v2/formats/orc/orc_file_reader.py:46— OrcFileReader._iter_fragment_tables has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (19 pts), ternaries 4 (5 pts), loops 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.
PredicatePushdown._try_push_down_predicate (cognitive 28) python/ray/data/_internal/logical/rules/predicate_pushdown.py:255— PredicatePushdown._try_push_down_predicate has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (23 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 14). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
NixlTensorTransport.fetch_multiple_tensors (cognitive 28) python/ray/experimental/rdt/nixl_tensor_transport.py:376— NixlTensorTransport.fetch_multiple_tensors has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 4 (10 pts), ternaries 2 (4 pts), 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.
RDTManager.fetch_and_get_rdt_objects (cognitive 28) python/ray/experimental/rdt/rdt_manager.py:897— RDTManager.fetch_and_get_rdt_objects has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (18 pts), error handling 2 (5 pts), loops 3 (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.
IMPALA.training_step (cognitive 28) python/ray/rllib/algorithms/impala/impala.py:656— IMPALA.training_step has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (18 pts), loops 4 (7 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.
modelv2._unpack_obs (cognitive 28) python/ray/rllib/models/modelv2.py:381— modelv2._unpack_obs has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (18 pts), loops 2 (6 pts), boolean chains 4 (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.
TFPolicy._initialize_loss (cognitive 28) python/ray/rllib/policy/tf_policy.py:692— TFPolicy._initialize_loss has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (18 pts), ternaries 3 (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.
memory.check_memory_leaks (cognitive 28) python/ray/rllib/utils/debug/memory.py:16— memory.check_memory_leaks has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 8 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
legacy_stats.merge_stats (cognitive 28) python/ray/rllib/utils/metrics/legacy_stats.py:961— legacy_stats.merge_stats has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (19 pts), loops 2 (6 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.
scripts.debug (cognitive 28) python/ray/scripts/scripts.py:351— scripts.debug has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 5 (11 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ServeControllerClient.deploy_applications (cognitive 28) python/ray/serve/_private/client.py:274— ServeControllerClient.deploy_applications has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 4 (5 pts), boolean chains 4, ternaries 1 (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.
_BatchQueue.wait_for_batch (cognitive 28) python/ray/serve/batching.py:279— _BatchQueue.wait_for_batch has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 3 (7 pts), boolean chains 2, 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.
CapacityQueueRouter._choose_replica_for_request (cognitive 28) python/ray/serve/experimental/capacity_queue_router.py:127— CapacityQueueRouter._choose_replica_for_request has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (17 pts), error handling 4 (7 pts), loops 2, 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.
_TorchAccelerator.prepare_model (cognitive 28) python/ray/train/torch/train_loop_utils.py:385— _TorchAccelerator.prepare_model has cognitive complexity 28 (threshold 15). Drivers by points: if/else 16 (25 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.
train_loop_utils.prepare_model (cognitive 28) python/ray/train/v2/torch/train_loop_utils.py:166— train_loop_utils.prepare_model has cognitive complexity 28 (threshold 15). Drivers by points: if/else 15 (23 pts), boolean chains 5 (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.
commands.list_trials (cognitive 28) python/ray/tune/cli/commands.py:97— commands.list_trials has cognitive complexity 28 (threshold 15). Drivers by points: if/else 16 (23 pts), loops 2 (4 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.
AxSearch._setup_experiment (cognitive 28) python/ray/tune/search/ax/ax_search.py:199— AxSearch._setup_experiment has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (17 pts), error handling 6 (7 pts), ternaries 2 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
profiling.chrome_tracing_dump (cognitive 27) python/ray/_private/profiling.py:122— profiling.chrome_tracing_dump has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (21 pts), loops 4 (6 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.
SerializationContext._deserialize_object (cognitive 27) REDACTED:424— SerializationContext._deserialize_object has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (22 pts), error handling 2 (5 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DataHead.get_datasets (cognitive 27) python/ray/dashboard/modules/data/data_head.py:68— DataHead.get_datasets has cognitive complexity 27 (threshold 15). Drivers by points: loops 8 (16 pts), if/else 2 (8 pts), error handling 2, 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.
dataset_repr._collect_materialized_rows_for_repr (cognitive 27) python/ray/data/_internal/dataset_repr.py:138— dataset_repr._collect_materialized_rows_for_repr has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 5 (7 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
streaming_executor_state.update_operator_states (cognitive 27) python/ray/data/_internal/execution/streaming_executor_state.py:1020— streaming_executor_state.update_operator_states has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 4 (7 pts), boolean chains 4 (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.
RichExecutionProgressManager._setup_operator_progress (cognitive 27) python/ray/data/_internal/progress/rich_progress.py:175— RichExecutionProgressManager._setup_operator_progress has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 2 (7 pts), loops 3 (5 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.
path_util._is_filesystem_compatible_with_scheme (cognitive 27) python/ray/data/datasource/path_util.py:170— path_util._is_filesystem_compatible_with_scheme has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (25 pts), boolean chains 1, ternaries 1 (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.
AlgorithmConfig.build_module_to_env_connector (cognitive 27) python/ray/rllib/algorithms/algorithm_config.py:1134— AlgorithmConfig.build_module_to_env_connector has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 4, error handling 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.
cql_torch_policy.cql_loss (cognitive 27) python/ray/rllib/algorithms/cql/cql_torch_policy.py:83— cql_torch_policy.cql_loss has cognitive complexity 27 (threshold 15). Drivers by points: if/else 22 (26 pts), ternaries 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.
TorchMultiStreamEncoder.__init__ (cognitive 27) python/ray/rllib/core/models/torch/encoder.py:306— TorchMultiStreamEncoder.__init__ has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 3 (8 pts), boolean chains 6 (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.
MultiAgentEpisodeReplayBuffer.add (cognitive 27) python/ray/rllib/utils/replay_buffers/multi_agent_episode_buffer.py:182— MultiAgentEpisodeReplayBuffer.add has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 7 (12 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MultiAgentMixInReplayBuffer.add (cognitive 27) python/ray/rllib/utils/replay_buffers/multi_agent_mixin_replay_buffer.py:199— MultiAgentMixInReplayBuffer.add has cognitive complexity 27 (threshold 15). Drivers by points: loops 7 (17 pts), if/else 2 (5 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
ReplicaConfig._validate_placement_group_options (cognitive 27) python/ray/serve/_private/config.py:935— ReplicaConfig._validate_placement_group_options has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (22 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Worker._get_object_iterator (cognitive 27) REDACTED:407— Worker._get_object_iterator has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (18 pts), error handling 2 (4 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tpu._find_undiscovered_idle_slice (cognitive 27) python/ray/util/tpu.py:1917— tpu._find_undiscovered_idle_slice has cognitive complexity 27 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 5 (8 pts), boolean chains 3, 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.
DependencySetManager._build (cognitive 26) ci/raydepsets/cli.py:170— DependencySetManager._build has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 4 (10 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.
dict.flatten_dict (cognitive 26) python/ray/_private/dict.py:103— dict.flatten_dict has cognitive complexity 26 (threshold 15). Drivers by points: loops 5 (13 pts), if/else 3 (9 pts), boolean chains 3, ternaries 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.
PrometheusServiceDiscoveryWriter.write (cognitive 26) python/ray/_private/metrics_agent.py:828— PrometheusServiceDiscoveryWriter.write has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (13 pts), error handling 3 (9 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.
packaging.download_and_unpack_package (cognitive 26) REDACTED:881— packaging.download_and_unpack_package has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (24 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.
services._find_address_from_flag (cognitive 26) python/ray/_private/services.py:283— services._find_address_from_flag has cognitive complexity 26 (threshold 15). Drivers by points: if/else 3 (13 pts), loops 3 (8 pts), error handling 2 (4 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
services.determine_plasma_store_config (cognitive 26) python/ray/_private/services.py:2182— services.determine_plasma_store_config has cognitive complexity 26 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 6 (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.
util.parse_usage (cognitive 26) python/ray/autoscaler/_private/util.py:620— util.parse_usage has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 2, boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
JobSupervisor.run (cognitive 26) REDACTED:317— JobSupervisor.run has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (18 pts), error handling 3 (6 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.
state_api_utils.convert_filters_type (cognitive 26) python/ray/dashboard/state_api_utils.py:128— state_api_utils.convert_filters_type has cognitive complexity 26 (threshold 15). Drivers by points: error handling 4 (15 pts), if/else 4 (7 pts), boolean chains 3, 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.
ActorPoolStrategy.__init__ (cognitive 26) python/ray/data/_internal/compute.py:109— ActorPoolStrategy.__init__ has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 8 (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.
LeRobotDatasource.__init__ (cognitive 26) python/ray/data/_internal/datasource/lerobot_datasource.py:1458— LeRobotDatasource.__init__ has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 4, loops 2 (3 pts), error handling 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.
ParquetDatasource.__init__ (cognitive 26) python/ray/data/_internal/datasource/parquet_datasource.py:213— ParquetDatasource.__init__ has cognitive complexity 26 (threshold 15). Drivers by points: if/else 17 (21 pts), boolean chains 4, ternaries 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.
tfrecords_datasink._value_to_feature (cognitive 26) python/ray/data/_internal/datasource/tfrecords_datasink.py:89— tfrecords_datasink._value_to_feature has cognitive complexity 26 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 4, 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.
webdataset_datasource._group_by_keys (cognitive 26) REDACTED:157— webdataset_datasource._group_by_keys has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (22 pts), boolean chains 3, 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.
OpRuntimeMetrics.on_task_output_generated (cognitive 26) python/ray/data/_internal/execution/interfaces/op_runtime_metrics.py:1042— OpRuntimeMetrics.on_task_output_generated has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 4 (6 pts), boolean chains 4 (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.
SynchronousReader._read_list (cognitive 26) python/ray/experimental/channel/common.py:357— SynchronousReader._read_list has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (18 pts), error handling 1 (3 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RDTManager._trigger_fetch (cognitive 26) python/ray/experimental/rdt/rdt_manager.py:559— RDTManager._trigger_fetch has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (22 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Algorithm.compute_single_action (cognitive 26) REDACTED:4662— Algorithm.compute_single_action has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 3, error handling 1 (2 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.
IMPALAConfig.training (cognitive 26) python/ray/rllib/algorithms/impala/impala.py:190— IMPALAConfig.training has cognitive complexity 26 (threshold 15). Drivers by points: if/else 26. 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.
TFPolicy.__init__ (cognitive 26) python/ray/rllib/policy/tf_policy.py:88— TFPolicy.__init__ has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 7, ternaries 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.
TorchPolicy._compute_action_helper (cognitive 26) python/ray/rllib/policy/torch_policy.py:919— TorchPolicy._compute_action_helper has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 3, error handling 1 (3 pts), ternaries 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.
actors.create_colocated_actors (cognitive 26) python/ray/rllib/utils/actors.py:71— actors.create_colocated_actors has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 3 (7 pts), boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DeploymentStateManager._shutdown_deletion_tiers (cognitive 26) python/ray/serve/_private/deployment_state.py:6975— DeploymentStateManager._shutdown_deletion_tiers has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 5 (9 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
progress_reporter._get_progress_table_data (cognitive 26) python/ray/tune/progress_reporter.py:942— progress_reporter._get_progress_table_data has cognitive complexity 26 (threshold 15). Drivers by points: if/else 15 (21 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HyperBandScheduler._process_bracket (cognitive 26) python/ray/tune/schedulers/hyperband.py:247— HyperBandScheduler._process_bracket has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (18 pts), boolean chains 4, 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.
debug._test_some_code_for_memory_leaks (cognitive 26) python/ray/util/debug.py:109— debug._test_some_code_for_memory_leaks has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (18 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.
ObjectSerializer.deserialize (cognitive 26) java/runtime/src/main/java/io/ray/runtime/object/ObjectSerializer.java:90— ObjectSerializer.deserialize has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 4 (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.
AdvancedProgressBar.AdvancedProgressBarSegment (cognitive 26) python/ray/dashboard/client/src/pages/job/AdvancedProgressBar/AdvancedProgressBar.tsx:78— AdvancedProgressBar.AdvancedProgressBarSegment has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 11 (20 pts), boolean chains 6 (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.
softwrap.collect (cognitive 25) doc/.claude/skills/ray-soft-wrap/scripts/softwrap.py:294— softwrap.collect has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 4 (9 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.
resource_demand_scheduler.get_nodes_for (cognitive 25) python/ray/autoscaler/_private/resource_demand_scheduler.py:729— resource_demand_scheduler.get_nodes_for has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (21 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
format_utils._get_args_lines (cognitive 25) python/ray/dag/format_utils.py:29— format_utils._get_args_lines has cognitive complexity 25 (threshold 15). Drivers by points: loops 7 (20 pts), if/else 4 (5 pts) (nesting depth added 14). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
transform_pyarrow.take_table (cognitive 25) python/ray/data/_internal/arrow_ops/transform_pyarrow.py:420— transform_pyarrow.take_table has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (15 pts), error handling 2 (7 pts), loops 1 (2 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.
join._join_tables_iter (cognitive 25) python/ray/data/_internal/execution/operators/join.py:227— join._join_tables_iter has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 4, ternaries 1 (2 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.
FuseOperators._can_fuse (cognitive 25) python/ray/data/_internal/logical/rules/operator_fusion.py:274— FuseOperators._can_fuse has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 11 (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.
SplitRepartitionTaskScheduler.execute (cognitive 25) python/ray/data/_internal/planner/exchange/split_repartition_task_scheduler.py:32— SplitRepartitionTaskScheduler.execute has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (19 pts), loops 5 (6 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.
PDOrchestratorMixin._can_reuse_prompt_token_ids (cognitive 25) python/ray/llm/_internal/serve/serving_patterns/prefill_decode/pd_server.py:172— PDOrchestratorMixin._can_reuse_prompt_token_ids has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 7, 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.
broadcast.broadcast (cognitive 25) REDACTED:17— broadcast.broadcast has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (20 pts), error handling 1 (2 pts), loops 2, 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.
DifferentiableLearner._create_iterator_if_necessary (cognitive 25) python/ray/rllib/core/learner/differentiable_learner.py:423— DifferentiableLearner._create_iterator_if_necessary has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PrioritizedEpisodeReplayBuffer.add (cognitive 25) python/ray/rllib/utils/replay_buffers/prioritized_episode_buffer.py:176— PrioritizedEpisodeReplayBuffer.add has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 4 (5 pts), ternaries 1 (4 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.
torch_utils.clip_gradients (cognitive 25) python/ray/rllib/utils/torch_utils.py:97— torch_utils.clip_gradients has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 3 (6 pts), ternaries 1 (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.
ConsistentHashRouter._fulfill_pending_requests (cognitive 25) python/ray/serve/experimental/consistent_hash_router.py:276— ConsistentHashRouter._fulfill_pending_requests has cognitive complexity 25 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 4 (9 pts), boolean chains 4, 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.
ScalingConfig._validate_tpu_config (cognitive 25) python/ray/train/v2/api/config.py:204— ScalingConfig._validate_tpu_config has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 4, error handling 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.
NevergradSearch._setup_nevergrad (cognitive 25) REDACTED:201— NevergradSearch._setup_nevergrad has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
variant_generator._generate_variants_internal (cognitive 25) REDACTED:241— variant_generator._generate_variants_internal has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 4 (9 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.
check_open_ports._get_ray_ports (cognitive 25) REDACTED:21— check_open_ports._get_ray_ports has cognitive complexity 25 (threshold 15). Drivers by points: if/else 2 (8 pts), loops 4 (8 pts), error handling 2 (6 pts), ternaries 1 (3 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.
scheduler._rayify_task (cognitive 25) python/ray/util/dask/scheduler.py:329— scheduler._rayify_task has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 2 (6 pts), 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.
MinimalClusterManager.create_cluster_compute (cognitive 24) release/ray_release/cluster_manager/minimal.py:148— MinimalClusterManager.create_cluster_compute has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 2 (5 pts), error handling 1 (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.
Node.start_ray_processes (cognitive 24) REDACTED:1684— Node.start_ray_processes has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (21 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
utils._get_docker_cpus (cognitive 24) python/ray/_private/utils.py:365— utils._get_docker_cpus has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (11 pts), error handling 3 (6 pts), boolean chains 5, 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.
worker.filter_autoscaler_events (cognitive 24) REDACTED:2235— worker.filter_autoscaler_events has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AWSNodeProvider._create_node (cognitive 24) python/ray/autoscaler/_private/aws/node_provider.py:368— AWSNodeProvider._create_node has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (13 pts), error handling 2 (6 pts), loops 3 (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.
SchedulingNode._satisfies_label_constraints (cognitive 24) python/ray/autoscaler/v2/scheduler.py:749— SchedulingNode._satisfies_label_constraints has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (18 pts), loops 3 (6 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.
dag_node_operation._generate_actor_to_execution_schedule (cognitive 24) python/ray/dag/dag_node_operation.py:713— dag_node_operation._generate_actor_to_execution_schedule has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 6 (11 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.
ReservationOpResourceAllocator.update_budgets (cognitive 24) python/ray/data/_internal/execution/resource_manager.py:981— ReservationOpResourceAllocator.update_budgets has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (19 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.
plan_download_op.download_bytes_threaded (cognitive 24) python/ray/data/_internal/planner/plan_download_op.py:312— plan_download_op.download_bytes_threaded has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (15 pts), error handling 1 (4 pts), loops 2 (4 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.
read_api._read_datasource_v2 (cognitive 24) python/ray/data/read_api.py:500— read_api._read_datasource_v2 has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 7 (8 pts), boolean chains 3, loops 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.
read_api.from_huggingface (cognitive 24) python/ray/data/read_api.py:5513— read_api.from_huggingface has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (15 pts), error handling 2 (6 pts), loops 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.
MemoryPoolManager.allocate_group (cognitive 24) python/ray/experimental/rdt/nixl_memory_pool.py:209— MemoryPoolManager.allocate_group has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 2 (4 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.
HttpRequestUDF.udf (cognitive 24) python/ray/llm/_internal/batch/stages/http_request_stage.py:124— HttpRequestUDF.udf has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 4 (5 pts), error handling 1 (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.
DQNConfig.validate (cognitive 24) python/ray/rllib/algorithms/dqn/dqn.py:426— DQNConfig.validate has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 6 (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.
AddColumnsFromEpisodesToTrainBatch.__call__ (cognitive 24) python/ray/rllib/connectors/learner/add_columns_from_episodes_to_train_batch.py:64— AddColumnsFromEpisodesToTrainBatch.__call__ has cognitive complexity 24 (threshold 15). Drivers by points: loops 6 (11 pts), if/else 5 (7 pts), ternaries 2 (6 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.
FaultTolerantActorManager.foreach_actor_async (cognitive 24) python/ray/rllib/utils/actor_manager.py:510— FaultTolerantActorManager.foreach_actor_async has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 3 (6 pts), loops 3 (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.
EpisodeReplayBuffer._sample_episodes (cognitive 24) python/ray/rllib/utils/replay_buffers/episode_replay_buffer.py:807— EpisodeReplayBuffer._sample_episodes has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 7, ternaries 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.
ApplicationState._reconcile_build_app_task (cognitive 24) python/ray/serve/_private/application_state.py:904— ApplicationState._reconcile_build_app_task has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (14 pts), error handling 5, 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.
_TorchBackend.on_start (cognitive 24) python/ray/train/torch/config.py:253— _TorchBackend.on_start has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (19 pts), ternaries 1 (3 pts), loops 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.
TrainContext.report (cognitive 24) python/ray/train/v2/_internal/execution/context.py:401— TrainContext.report has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 4, error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
check_serialize._inspect_serializability (cognitive 24) python/ray/util/check_serialize.py:204— check_serialize._inspect_serializability has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (12 pts), ternaries 4 (9 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.
rpdb._connect_pdb_client (cognitive 24) python/ray/util/rpdb.py:355— rpdb._connect_pdb_client has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 2 (3 pts), boolean chains 1, ternaries 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.
_ActorClassMethodMetadata.create (cognitive 23) python/ray/actor.py:1274— _ActorClassMethodMetadata.create has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 2, 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.
AWSNodeProvider.fillout_available_node_types_resources (cognitive 23) python/ray/autoscaler/_private/aws/node_provider.py:638— AWSNodeProvider.fillout_available_node_types_resources 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.
cli_logger._format_msg (cognitive 23) python/ray/autoscaler/_private/cli_logger.py:135— cli_logger._format_msg has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dag_node_operation._generate_overlapped_execution_schedule (cognitive 23) python/ray/dag/dag_node_operation.py:789— dag_node_operation._generate_overlapped_execution_schedule has cognitive complexity 23 (threshold 15). Drivers by points: if/else 3 (13 pts), loops 3 (7 pts), boolean chains 3 (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.
ReportHead.jax_profile (cognitive 23) python/ray/dashboard/modules/reporter/reporter_head.py:834— ReportHead.jax_profile has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (15 pts), error handling 4 (7 pts), boolean chains 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.
_AutoscalingCoordinatorActor.request_resources (cognitive 23) python/ray/data/_internal/cluster_autoscaler/default_autoscaling_coordinator.py:391— _AutoscalingCoordinatorActor.request_resources has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 5, 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.
delta_datasink._nested_schema_additions (cognitive 23) REDACTED:50— delta_datasink._nested_schema_additions has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 7, loops 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.
delta_datasink._explicit_filesystem_from_storage_options (cognitive 23) REDACTED:891— delta_datasink._explicit_filesystem_from_storage_options has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (18 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.
ResourceManager.get_op_usage_str (cognitive 23) python/ray/data/_internal/execution/resource_manager.py:352— ResourceManager.get_op_usage_str has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (22 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.
PushBasedShuffleTaskScheduler.execute (cognitive 23) python/ray/data/_internal/planner/exchange/push_based_shuffle_task_scheduler.py:449— PushBasedShuffleTaskScheduler.execute has cognitive complexity 23 (threshold 15). Drivers by points: loops 6 (9 pts), if/else 7, error handling 3 (6 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.
OperatorStatsSummary.__str__ (cognitive 23) python/ray/data/_internal/stats.py:1928— OperatorStatsSummary.__str__ has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 3, loops 1 (3 pts), ternaries 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DataIterator.to_torch (cognitive 23) python/ray/data/iterator.py:845— DataIterator.to_torch has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (22 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PDOrchestratorMixin._pd_handle_request (cognitive 23) python/ray/llm/_internal/serve/serving_patterns/prefill_decode/pd_server.py:247— PDOrchestratorMixin._pd_handle_request has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (13 pts), loops 5 (10 pts) (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
PDOrchestratorMixin._concurrent_decode (cognitive 23) python/ray/llm/_internal/serve/serving_patterns/prefill_decode/pd_server.py:399— PDOrchestratorMixin._concurrent_decode has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (15 pts), error handling 3 (5 pts), boolean chains 2, 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.
AlgorithmConfig.training (cognitive 23) python/ray/rllib/algorithms/algorithm_config.py:2515— AlgorithmConfig.training has cognitive complexity 23 (threshold 15). Drivers by points: if/else 21 (23 pts) (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.
DQNConfig.training (cognitive 23) python/ray/rllib/algorithms/dqn/dqn.py:213— DQNConfig.training has cognitive complexity 23 (threshold 15). Drivers by points: if/else 23. 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.
SACConfig.validate (cognitive 23) python/ray/rllib/algorithms/sac/sac.py:390— SACConfig.validate has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 11, if/else 9 (10 pts), ternaries 1 (2 pts) (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.
sac_tf_policy.sac_actor_critic_loss (cognitive 23) python/ray/rllib/algorithms/sac/sac_tf_policy.py:236— sac_tf_policy.sac_actor_critic_loss has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (19 pts), ternaries 2 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
sac_torch_policy.actor_critic_loss (cognitive 23) python/ray/rllib/algorithms/sac/sac_torch_policy.py:168— sac_torch_policy.actor_critic_loss has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (19 pts), ternaries 2 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TorchDifferentiableLearner.apply_gradients (cognitive 23) python/ray/rllib/core/learner/torch/torch_differentiable_learner.py:203— TorchDifferentiableLearner.apply_gradients has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (15 pts), boolean chains 5, 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.
json_reader.from_json_data (cognitive 23) python/ray/rllib/offline/json_reader.py:183— json_reader.from_json_data has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 3 (7 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.
SampleBatch._get_slice_indices (cognitive 23) python/ray/rllib/policy/sample_batch.py:1234— SampleBatch._get_slice_indices has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 2 (4 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
TorchPolicy.learn_on_loaded_batch (cognitive 23) python/ray/rllib/policy/torch_policy.py:537— TorchPolicy.learn_on_loaded_batch has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (13 pts), loops 6 (8 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
TorchPolicyV2.learn_on_loaded_batch (cognitive 23) python/ray/rllib/policy/torch_policy_v2.py:716— TorchPolicyV2.learn_on_loaded_batch has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (13 pts), loops 6 (8 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
env._check_done_and_truncated (cognitive 23) python/ray/rllib/utils/pre_checks/env.py:129— env._check_done_and_truncated has cognitive complexity 23 (threshold 15). Drivers by points: if/else 3 (12 pts), loops 3 (8 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.
ServeController.run_control_loop_step (cognitive 23) REDACTED:668— ServeController.run_control_loop_step has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (12 pts), error handling 5 (7 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.
DeploymentScheduler._get_replicas_to_stop (cognitive 23) python/ray/serve/_private/deployment_scheduler.py:1319— DeploymentScheduler._get_replicas_to_stop has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 5 (8 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.
DeploymentStateManager._detect_and_remove_leaked_placement_groups (cognitive 23) python/ray/serve/_private/deployment_state.py:6800— DeploymentStateManager._detect_and_remove_leaked_placement_groups has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 4 (6 pts), error handling 2 (4 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.
LongPollHost.listen_for_change (cognitive 23) python/ray/serve/_private/long_poll.py:412— LongPollHost.listen_for_change has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 5 (6 pts), error handling 2 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
autoscaling_policy._query_prometheus (cognitive 23) REDACTED:468— autoscaling_policy._query_prometheus has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 5, 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.
DataServicerProxy.Datapath (cognitive 23) REDACTED:723— DataServicerProxy.Datapath has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (18 pts), error handling 2 (3 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.
Worker._connect_channel (cognitive 23) REDACTED:250— Worker._connect_channel has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (16 pts), error handling 2 (4 pts), boolean chains 2, 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.
RayClusterOnSpark.wait_until_ready (cognitive 23) REDACTED:132— RayClusterOnSpark.wait_until_ready has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (19 pts), error handling 1 (2 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.
api-nav-loader.init (cognitive 23) doc/source/_static/api-nav-loader.js:11— api-nav-loader.init has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 8). Most of this is not in the body itself: 2 of the 23 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 26, 61, 22, …). 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.
utils.get_cgroup_aware_swap_memory (cognitive 22) REDACTED:447— utils.get_cgroup_aware_swap_memory has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (14 pts), error handling 2 (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.
LogDeduplicator.deduplicate (cognitive 22) python/ray/_private/ray_logging/__init__.py:263— LogDeduplicator.deduplicate has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 4, 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.
conda_utils.get_conda_bin_executable (cognitive 22) REDACTED:43— conda_utils.get_conda_bin_executable has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (22 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.
pip._get_pip_hash (cognitive 22) REDACTED:43— pip._get_pip_hash has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (17 pts), error handling 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.
SSHCommandRunner.run (cognitive 22) python/ray/autoscaler/_private/command_runner.py:333— SSHCommandRunner.run has cognitive complexity 22 (threshold 15). Drivers by points: if/else 16 (20 pts), loops 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.
commands._bootstrap_config (cognitive 22) python/ray/autoscaler/_private/commands.py:363— commands._bootstrap_config has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (19 pts), error handling 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.
Monitor.update_load_metrics (cognitive 22) python/ray/autoscaler/_private/monitor.py:243— Monitor.update_load_metrics has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 3 (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.
dag_node_operation._visualize_execution_schedule (cognitive 22) python/ray/dag/dag_node_operation.py:581— dag_node_operation._visualize_execution_schedule has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 3 (11 pts), loops 5 (9 pts), error handling 1, if/else 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.
default_autoscaling_coordinator._compute_reservations (cognitive 22) python/ray/data/_internal/cluster_autoscaler/default_autoscaling_coordinator.py:713— default_autoscaling_coordinator._compute_reservations has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 3 (5 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.
LanceDatasource.get_read_tasks (cognitive 22) python/ray/data/_internal/datasource/lance_datasource.py:77— LanceDatasource.get_read_tasks has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 2 (3 pts), ternaries 2 (3 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.
ParquetDatasink.__init__ (cognitive 22) python/ray/data/_internal/datasource/parquet_datasink.py:174— ParquetDatasink.__init__ has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 6 (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.
WebDatasetDatasource._read_stream (cognitive 22) REDACTED:414— WebDatasetDatasource._read_stream has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (4 pts), 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.
ZarrV2Datasource._load_metadata (cognitive 22) python/ray/data/_internal/datasource/zarrv2_datasource.py:618— ZarrV2Datasource._load_metadata has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (14 pts), error handling 1 (3 pts), boolean chains 2, loops 1 (2 pts), 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.
HiveReadSpec.__post_init__ (cognitive 22) python/ray/data/_internal/datasource_v2/formats/hive/hive_contract.py:45— HiveReadSpec.__post_init__ has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 6 (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.
FooterFileIndexer._read_footers (cognitive 22) python/ray/data/_internal/datasource_v2/formats/parquet/footer_file_indexer.py:328— FooterFileIndexer._read_footers has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (14 pts), loops 4 (7 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
numpy_support.convert_to_numpy (cognitive 22) python/ray/data/_internal/numpy_support.py:120— numpy_support.convert_to_numpy has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (14 pts), error handling 2 (4 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.
plan_download_op._resolve_threaded_outcomes (cognitive 22) python/ray/data/_internal/planner/plan_download_op.py:237— plan_download_op._resolve_threaded_outcomes has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 3 (5 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_TransformingBatchIterator.__next__ (cognitive 22) python/ray/data/_internal/planner/plan_udf_map_op.py:575— _TransformingBatchIterator.__next__ has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (14 pts), error handling 2 (6 pts), boolean chains 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.
Chain._materialize_deferred_stats (cognitive 22) python/ray/data/preprocessors/chain.py:193— Chain._materialize_deferred_stats has cognitive complexity 22 (threshold 15). Drivers by points: loops 5 (11 pts), if/else 4 (8 pts), boolean chains 3 (nesting depth added 10). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
Learner._make_batch_if_necessary (cognitive 22) python/ray/rllib/core/learner/learner.py:1668— Learner._make_batch_if_necessary has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (5 pts), ternaries 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.
SampleBatch._slice (cognitive 22) python/ray/rllib/policy/sample_batch.py:1146— SampleBatch._slice has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 5, loops 1 (3 pts), 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.
SampleBatch.get_single_step_input_dict (cognitive 22) python/ray/rllib/policy/sample_batch.py:1285— SampleBatch.get_single_step_input_dict has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (13 pts), ternaries 2 (7 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.
autoscaling_policy._apply_delay_logic (cognitive 22) REDACTED:68— autoscaling_policy._apply_delay_logic has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (21 pts), 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.
TuneController.__init__ (cognitive 22) python/ray/tune/execution/tune_controller.py:76— TuneController.__init__ has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 5, 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.
TuneController._maybe_add_actors (cognitive 22) python/ray/tune/execution/tune_controller.py:829— TuneController._maybe_add_actors has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 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.
TuneController._validate_result_metrics (cognitive 22) python/ray/tune/execution/tune_controller.py:1642— TuneController._validate_result_metrics has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 3 (6 pts), boolean chains 4 (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.
OptunaSearch._setup_study (cognitive 22) REDACTED:395— OptunaSearch._setup_study has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (11 pts), loops 2 (6 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.
tpu._find_available_subslice (cognitive 22) python/ray/util/tpu.py:1661— tpu._find_available_subslice has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
JobFunctionTable.loadFunctionsForClass (cognitive 22) java/runtime/src/main/java/io/ray/runtime/functionmanager/FunctionManager.java:189— JobFunctionTable.loadFunctionsForClass has cognitive complexity 22 (threshold 15). Drivers by points: if/else 3 (7 pts), loops 5 (7 pts), ternaries 2 (4 pts), boolean chains 3, 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.
PlatformEvents.PlatformEvents (cognitive 22) python/ray/dashboard/client/src/pages/events/PlatformEvents.tsx:35— PlatformEvents.PlatformEvents has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 9, ternaries 5 (8 pts), if/else 5 (nesting depth added 3). Most of this is not in the body itself: 6 of the 22 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 246, 80, 102, …). 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.
ClusterManager._annotate_cluster_compute (cognitive 21) release/ray_release/cluster_manager/cluster_manager.py:85— ClusterManager._annotate_cluster_compute has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 7, 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.
ray_bisect._obtain_test_result (cognitive 21) release/ray_release/scripts/ray_bisect.py:216— ray_bisect._obtain_test_result has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 3 (6 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.
runtime_env_uri.parse_uri (cognitive 21) REDACTED:72— runtime_env_uri.parse_uri has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 2, 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.
_AioSubscriber._poll (cognitive 21) python/ray/_private/gcs_pubsub.py:133— _AioSubscriber._poll has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 2 (3 pts), error handling 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.
LogMonitor.open_closed_files (cognitive 21) python/ray/_private/log_monitor.py:306— LogMonitor.open_closed_files has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (15 pts), error handling 2 (5 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.
RuntimeEnvPluginSchemaManager._load_schemas_from_env_var (cognitive 21) python/ray/_private/runtime_env/plugin_schema_manager.py:62— RuntimeEnvPluginSchemaManager._load_schemas_from_env_var has cognitive complexity 21 (threshold 15). Drivers by points: loops 3 (11 pts), if/else 3 (10 pts) (nesting depth added 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
CloudwatchHelper._ssm_command_waiter (cognitive 21) python/ray/autoscaler/_private/aws/cloudwatch/cloudwatch_helper.py:197— CloudwatchHelper._ssm_command_waiter has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (20 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.
SchedulingNode._compute_score (cognitive 21) python/ray/autoscaler/v2/scheduler.py:650— SchedulingNode._compute_score has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 4 (5 pts), boolean chains 2, ternaries 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.
KubernetesEventProvider._run_pod_membership_watch (cognitive 21) python/ray/dashboard/modules/platform_events/providers/k8s_provider.py:342— KubernetesEventProvider._run_pod_membership_watch has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (13 pts), error handling 2 (4 pts), loops 2 (3 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.
task_event_query._passes_filters (cognitive 21) python/ray/dashboard/modules/task_events/task_event_query.py:43— task_event_query._passes_filters has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 5 (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.
runtime_env_redaction.redact_state_rows (cognitive 21) python/ray/dashboard/runtime_env_redaction.py:80— runtime_env_redaction.redact_state_rows has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 4 (7 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.
transform_pyarrow._backfill_missing_fields (cognitive 21) python/ray/data/_internal/arrow_ops/transform_pyarrow.py:770— transform_pyarrow._backfill_missing_fields has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (15 pts), error handling 1 (4 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.
default_cluster_autoscaler_v2._get_node_resource_spec_and_count (cognitive 21) python/ray/data/_internal/cluster_autoscaler/default_cluster_autoscaler_v2.py:90— default_cluster_autoscaler_v2._get_node_resource_spec_and_count has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 4, loops 3 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LineageTracker.register_task_submission (cognitive 21) python/ray/data/_internal/execution/lineage_tracker.py:244— LineageTracker.register_task_submission has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 2, 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.
BlockAccessor.batch_to_block (cognitive 21) python/ray/data/block.py:609— BlockAccessor.batch_to_block has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 3, error handling 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.
data_batch_conversion._cast_tensor_columns_to_ndarrays (cognitive 21) python/ray/data/util/data_batch_conversion.py:304— data_batch_conversion._cast_tensor_columns_to_ndarrays has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (13 pts), ternaries 1 (4 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.
RDTManager._monitor_failures (cognitive 21) python/ray/experimental/rdt/rdt_manager.py:316— RDTManager._monitor_failures has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 3 (5 pts), error handling 1 (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.
Algorithm.compute_actions (cognitive 21) REDACTED:4782— Algorithm.compute_actions has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (16 pts), loops 4, boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
DQN._training_step_new_api_stack (cognitive 21) python/ray/rllib/algorithms/dqn/dqn.py:653— DQN._training_step_new_api_stack has cognitive complexity 21 (threshold 15). Drivers by points: loops 4 (10 pts), if/else 4 (8 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.
DreamerV3Config.training (cognitive 21) python/ray/rllib/algorithms/dreamerv3/dreamerv3.py:174— DreamerV3Config.training has cognitive complexity 21 (threshold 15). Drivers by points: if/else 21. 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.
_LearnerThread.step (cognitive 21) python/ray/rllib/algorithms/impala/impala_learner.py:535— _LearnerThread.step has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (15 pts), error handling 2 (5 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FlattenObservations.recompute_output_observation_space (cognitive 21) python/ray/rllib/connectors/common/flatten_observations.py:299— FlattenObservations.recompute_output_observation_space has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 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.
SimpleListCollector.try_build_truncated_episode_multi_agent_batch (cognitive 21) python/ray/rllib/evaluation/collectors/simple_list_collector.py:613— SimpleListCollector.try_build_truncated_episode_multi_agent_batch has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (14 pts), ternaries 2 (6 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.
ModelV2.__call__ (cognitive 21) python/ray/rllib/models/modelv2.py:187— ModelV2.__call__ has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 4, error handling 1 (2 pts), loops 1 (2 pts), ternaries 1 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
dataset_reader._unzip_if_needed (cognitive 21) python/ray/rllib/offline/dataset_reader.py:31— dataset_reader._unzip_if_needed has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (13 pts), error handling 2 (7 pts), 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.
OfflineSingleAgentEnvRunner._map_episodes_to_data (cognitive 21) python/ray/rllib/offline/offline_env_runner.py:297— OfflineSingleAgentEnvRunner._map_episodes_to_data has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 6 (18 pts), loops 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.
sample_batch.attempt_count_timesteps (cognitive 21) python/ray/rllib/policy/sample_batch.py:34— sample_batch.attempt_count_timesteps has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 4, ternaries 2 (4 pts), error handling 1 (2 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.
FaultTolerantActorManager._call_actors (cognitive 21) python/ray/rllib/utils/actor_manager.py:850— FaultTolerantActorManager._call_actors has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 3 (9 pts), loops 3 (6 pts), boolean chains 3, if/else 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.
actors.split_colocated (cognitive 21) python/ray/rllib/utils/actors.py:191— actors.split_colocated has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 4 (8 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.
Stats.reduce (cognitive 21) python/ray/rllib/utils/metrics/legacy_stats.py:371— Stats.reduce has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
metrics_logger.stats_from_legacy_state (cognitive 21) python/ray/rllib/utils/metrics/metrics_logger.py:47— metrics_logger.stats_from_legacy_state has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (19 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.
env._check_reward (cognitive 21) python/ray/rllib/utils/pre_checks/env.py:89— env._check_reward has cognitive complexity 21 (threshold 15). Drivers by points: if/else 3 (9 pts), boolean chains 7, loops 2 (5 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.
utils.validate_buffer_config (cognitive 21) python/ray/rllib/utils/replay_buffers/utils.py:206— utils.validate_buffer_config has cognitive complexity 21 (threshold 15). Drivers by points: if/else 15 (19 pts), boolean chains 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.
tf_utils.flatten_inputs_to_1d_tensor (cognitive 21) python/ray/rllib/utils/tf_utils.py:105— tf_utils.flatten_inputs_to_1d_tensor has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 1, ternaries 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
torch_utils.flatten_inputs_to_1d_tensor (cognitive 21) python/ray/rllib/utils/torch_utils.py:379— torch_utils.flatten_inputs_to_1d_tensor has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 1, ternaries 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DeploymentState._forcefully_stop_gang_replicas (cognitive 21) python/ray/serve/_private/deployment_state.py:5434— DeploymentState._forcefully_stop_gang_replicas has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 4 (5 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.
HAProxyMetricsCollector.record (cognitive 21) REDACTED:326— HAProxyMetricsCollector.record has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 6, 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.
Replica._perform_graceful_shutdown (cognitive 21) REDACTED:2192— Replica._perform_graceful_shutdown has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (9 pts), error handling 4 (8 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
output._get_dict_as_table_data (cognitive 21) python/ray/tune/experimental/output.py:482— output._get_dict_as_table_data has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 4, 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.
TuneReporterBase._infer_user_metrics (cognitive 21) python/ray/tune/progress_reporter.py:389— TuneReporterBase._infer_user_metrics has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 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.
variant_generator._split_resolved_unresolved_values (cognitive 21) REDACTED:478— variant_generator._split_resolved_unresolved_values has cognitive complexity 21 (threshold 15). Drivers by points: loops 6 (18 pts), if/else 2 (3 pts) (nesting depth added 13). 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.
file_transfer._pack_dir (cognitive 21) python/ray/tune/utils/file_transfer.py:227— file_transfer._pack_dir has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (8 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.
server.main (cognitive 21) REDACTED:863— server.main has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (16 pts), error handling 2 (3 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.
TaskTable.TaskTable (cognitive 21) python/ray/dashboard/client/src/components/TaskTable.tsx:42— TaskTable.TaskTable has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 16, boolean chains 5. Most of this is not in the body itself: 3 of the 21 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 218, 141, 176, …). 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.
ActorDetail.ActorDetailPage (cognitive 21) python/ray/dashboard/client/src/pages/actor/ActorDetail.tsx:53— ActorDetail.ActorDetailPage has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 15 (16 pts), boolean chains 4, if/else 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.
step.get_step (cognitive 20) release/ray_release/buildkite/step.py:122— step.get_step has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 3, 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.
AnyscaleJobManager._wait_job (cognitive 20) release/ray_release/job_manager/anyscale_job_manager.py:176— AnyscaleJobManager._wait_job has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 2, 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.
LogAggregator._compute_stack_trace (cognitive 20) release/ray_release/log_aggregator.py:42— LogAggregator._compute_stack_trace has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
check_api_annotations.verify (cognitive 20) ci/lint/check_api_annotations.py:55— check_api_annotations.verify has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 2, 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.
run_docstring_examples.run_docstring (cognitive 20) ci/ray_ci/doc/run_docstring_examples.py:214— run_docstring_examples.run_docstring has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (16 pts), error handling 1 (2 pts), boolean chains 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.
tpu._build_subslice_labels (cognitive 20) REDACTED:432— tpu._build_subslice_labels has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OpenCensusProxyCollector.to_prometheus_metrics (cognitive 20) python/ray/_private/metrics_agent.py:349— OpenCensusProxyCollector.to_prometheus_metrics has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 1 (2 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.
utils.detect_fate_sharing_support_win32 (cognitive 20) python/ray/_private/utils.py:750— utils.detect_fate_sharing_support_win32 has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 5 (11 pts), if/else 3 (6 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.
ActorMethod._remote (cognitive 20) python/ray/actor.py:1079— ActorMethod._remote has cognitive complexity 20 (threshold 15). Drivers by points: if/else 15 (18 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.
Result.from_path (cognitive 20) python/ray/air/result.py:141— Result.from_path has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 3 (7 pts), loops 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.
AWSNodeProvider._merge_tag_specs (cognitive 20) python/ray/autoscaler/_private/aws/node_provider.py:336— AWSNodeProvider._merge_tag_specs has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 3 (8 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cluster_dump._info_from_params (cognitive 20) python/ray/autoscaler/_private/cluster_dump.py:590— cluster_dump._info_from_params has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4, loops 1 (2 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.
commands.rsync (cognitive 20) python/ray/autoscaler/_private/commands.py:1376— commands.rsync has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (12 pts), loops 2 (3 pts), ternaries 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.
resource_demand_scheduler._resource_based_utilization_scorer (cognitive 20) python/ray/autoscaler/_private/resource_demand_scheduler.py:811— resource_demand_scheduler._resource_based_utilization_scorer has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 3 (4 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.
CompiledDAG._track_communicator_usage (cognitive 20) python/ray/dag/compiled_dag_node.py:1379— CompiledDAG._track_communicator_usage has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (19 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.
ReporterAgent._ingest_exported_metrics (cognitive 20) REDACTED:809— ReporterAgent._ingest_exported_metrics has cognitive complexity 20 (threshold 15). Drivers by points: if/else 3 (10 pts), loops 3 (6 pts), error handling 1 (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.
TrainHead._add_actor_status_and_update_run_status (cognitive 20) python/ray/dashboard/modules/train/train_head.py:359— TrainHead._add_actor_status_and_update_run_status has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 2 (3 pts), 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.
KafkaDatasource.__init__ (cognitive 20) python/ray/data/_internal/datasource/kafka_datasource.py:467— KafkaDatasource.__init__ has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4, loops 1 (2 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.
parquet_datasource._iter_batches_fallback (cognitive 20) python/ray/data/_internal/datasource/parquet_datasource.py:1076— parquet_datasource._iter_batches_fallback has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 4, boolean chains 3, 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.
OpRuntimeMetrics.on_task_finished (cognitive 20) python/ray/data/_internal/execution/interfaces/op_runtime_metrics.py:1147— OpRuntimeMetrics.on_task_finished has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 2 (4 pts), boolean chains 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.
StoreRegistry.get (cognitive 20) python/ray/data/_internal/planner/_obstore_download.py:1020— StoreRegistry.get has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 3 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_StatsActor.update_execution_metrics (cognitive 20) python/ray/data/_internal/stats.py:779— _StatsActor.update_execution_metrics has cognitive complexity 20 (threshold 15). Drivers by points: loops 8 (16 pts), if/else 2 (4 pts) (nesting depth added 10). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
_StatsActor.update_dataset_metadata_operator_states (cognitive 20) python/ray/data/_internal/stats.py:1022— _StatsActor.update_dataset_metadata_operator_states has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (17 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.
ArrowTensorArray._from_numpy (cognitive 20) python/ray/data/_internal/tensor_extensions/arrow.py:909— ArrowTensorArray._from_numpy has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 5, 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, 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.
util._autodetect_parallelism (cognitive 20) python/ray/data/_internal/util.py:141— util._autodetect_parallelism has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (16 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.
util._insert_doc_at_pattern (cognitive 20) python/ray/data/_internal/util.py:410— util._insert_doc_at_pattern has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (17 pts), loops 1 (2 pts), boolean chains 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.
path_util._resolve_single_path_with_fallback (cognitive 20) python/ray/data/datasource/path_util.py:309— path_util._resolve_single_path_with_fallback has cognitive complexity 20 (threshold 15). Drivers by points: error handling 6 (9 pts), if/else 6 (7 pts), boolean chains 3, 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.
StatefulStageUDF.__call__ (cognitive 20) python/ray/llm/_internal/batch/stages/base.py:106— StatefulStageUDF.__call__ has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 4 (5 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.
PrefixTree.insert (cognitive 20) python/ray/llm/_internal/serve/routing_policies/prefix_aware/prefix_tree.py:253— PrefixTree.insert has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 2 (4 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.
DPServer.get_deployment_options (cognitive 20) python/ray/llm/_internal/serve/serving_patterns/data_parallel/dp_server.py:244— DPServer.get_deployment_options has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 3, loops 1 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Algorithm._maybe_wait_for_eval_env_runner_recovery (cognitive 20) REDACTED:1661— Algorithm._maybe_wait_for_eval_env_runner_recovery has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (15 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.
cql_tf_policy.cql_loss (cognitive 20) python/ray/rllib/algorithms/cql/cql_tf_policy.py:85— cql_tf_policy.cql_loss has cognitive complexity 20 (threshold 15). Drivers by points: if/else 18 (20 pts) (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.
SACConfig.training (cognitive 20) python/ray/rllib/algorithms/sac/sac.py:140— SACConfig.training has cognitive complexity 20 (threshold 15). Drivers by points: if/else 20. 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.
utils.get_activation_fn (cognitive 20) python/ray/rllib/models/utils.py:8— utils.get_activation_fn has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (19 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.
JsonReader.__init__ (cognitive 20) python/ray/rllib/offline/json_reader.py:234— JsonReader.__init__ has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (16 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OfflineData.sample (cognitive 20) python/ray/rllib/offline/offline_data.py:121— OfflineData.sample has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 3, 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.
Policy.from_checkpoint (cognitive 20) REDACTED:272— Policy.from_checkpoint has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (6 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.
MiniBatchCyclicIterator.__iter__ (cognitive 20) python/ray/rllib/utils/minibatch_utils.py:150— MiniBatchCyclicIterator.__iter__ has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 3 (6 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
build_app.build_app (cognitive 20) python/ray/serve/_private/build_app.py:131— build_app.build_app has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (16 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.
DeploymentStatusInfo.handle_transition (cognitive 20) python/ray/serve/_private/common.py:328— DeploymentStatusInfo.handle_transition has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (17 pts), ternaries 1 (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.
nccl_ras.format_ranks (cognitive 20) python/ray/train/v2/_internal/callbacks/nccl_ras.py:784— nccl_ras.format_ranks has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 2 (4 pts), loops 2 (3 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.
commands.list_experiments (cognitive 20) python/ray/tune/cli/commands.py:202— commands.list_experiments has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (17 pts), loops 2 (3 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.
output._infer_user_metrics (cognitive 20) python/ray/tune/experimental/output.py:196— output._infer_user_metrics has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (17 pts), loops 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.
NevergradSearch.__init__ (cognitive 20) REDACTED:123— NevergradSearch.__init__ has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 7 (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.
ProxyManager._create_runtime_env (cognitive 20) REDACTED:249— ProxyManager._create_runtime_env has cognitive complexity 20 (threshold 15). Drivers by points: error handling 3 (7 pts), if/else 3 (6 pts), ternaries 1 (4 pts), boolean chains 2, 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.
cluster_init._setup_ray_cluster (cognitive 20) REDACTED:479— cluster_init._setup_ray_cluster has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (17 pts), error handling 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.
ArgumentsBuilder.wrap (cognitive 20) java/runtime/src/main/java/io/ray/runtime/task/ArgumentsBuilder.java:27— ArgumentsBuilder.wrap 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.
api_param_coverage.documented_params (cognitive 19) ci/ray_ci/doc/api_param_coverage.py:44— api_param_coverage.documented_params has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (17 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.
run_docstring_examples.missing_library (cognitive 19) ci/ray_ci/doc/run_docstring_examples.py:117— run_docstring_examples.missing_library has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
label_utils.validate_fallback_strategy (cognitive 19) python/ray/_private/label_utils.py:196— label_utils.validate_fallback_strategy has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (16 pts), 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.
LogMonitor._close_all_files (cognitive 19) python/ray/_private/log_monitor.py:198— LogMonitor._close_all_files has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (13 pts), error handling 1 (4 pts), boolean chains 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.
LogMonitor.update_log_filenames (cognitive 19) python/ray/_private/log_monitor.py:242— LogMonitor.update_log_filenames has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (17 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.
LogMonitor.check_log_files_and_publish_updates (cognitive 19) python/ray/_private/log_monitor.py:365— LogMonitor.check_log_files_and_publish_updates has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (12 pts), error handling 1 (3 pts), loops 2 (3 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.
worker.print_worker_logs (cognitive 19) REDACTED:2318— worker.print_worker_logs has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (17 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.
ResourceDemandScheduler._update_node_resources_from_runtime (cognitive 19) python/ray/autoscaler/_private/resource_demand_scheduler.py:341— ResourceDemandScheduler._update_node_resources_from_runtime has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
KubeRayProvider._delete_idle_ray_cluster (cognitive 19) python/ray/autoscaler/v2/instance_manager/cloud_providers/kuberay/cloud_provider.py:781— KubeRayProvider._delete_idle_ray_cluster has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), error handling 4 (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.
CompiledDAG._init_communicators (cognitive 19) python/ray/dag/compiled_dag_node.py:1315— CompiledDAG._init_communicators has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 5 (8 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.
DAGNode.traverse_and_apply (cognitive 19) python/ray/dag/dag_node.py:545— DAGNode.traverse_and_apply has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 2 (4 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.
KubernetesEventProvider._run_pod_events_watch (cognitive 19) python/ray/dashboard/modules/platform_events/providers/k8s_provider.py:423— KubernetesEventProvider._run_pod_events_watch has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (11 pts), error handling 2 (4 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.
HudiDatasource.get_read_tasks (cognitive 19) python/ray/data/_internal/datasource/hudi_datasource.py:45— HudiDatasource.get_read_tasks has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 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.
IcebergDatasink._rewrite_partially_matched_files (cognitive 19) REDACTED:1092— IcebergDatasink._rewrite_partially_matched_files has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 5 (7 pts), boolean chains 1, 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.
IcebergDatasink.on_write_complete (cognitive 19) REDACTED:1198— IcebergDatasink.on_write_complete has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 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.
lerobot_datasource._decode_image_frames (cognitive 19) python/ray/data/_internal/datasource/lerobot_datasource.py:1308— lerobot_datasource._decode_image_frames has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 3 (8 pts), if/else 3 (7 pts), loops 2 (3 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.
RefBundle.__post_init__ (cognitive 19) python/ray/data/_internal/execution/interfaces/ref_bundle.py:127— RefBundle.__post_init__ has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 3 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PandasBlockAccessor.size_bytes (cognitive 19) python/ray/data/_internal/pandas_block.py:656— PandasBlockAccessor.size_bytes has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), error handling 1 (3 pts), boolean chains 2, 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.
DatasetStats.to_summary (cognitive 19) python/ray/data/_internal/stats.py:1344— DatasetStats.to_summary has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 2 (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.
util.make_async_gen (cognitive 19) python/ray/data/_internal/util.py:1122— util.make_async_gen has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 3 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TopKUnique.aggregate_block (cognitive 19) REDACTED:2049— TopKUnique.aggregate_block has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 4, ternaries 2 (4 pts), 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.
Dataset.rename_columns (cognitive 19) REDACTED:1711— Dataset.rename_columns has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (17 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.
Schema.types (cognitive 19) REDACTED:8695— Schema.types has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), error handling 2 (6 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.
read_api.from_arrow (cognitive 19) python/ray/data/read_api.py:5222— read_api.from_arrow has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 1 (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.
RayTaskError.__str__ (cognitive 19) REDACTED:324— RayTaskError.__str__ has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 3, ternaries 1 (2 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.
AwaitableBackgroundReader._run (cognitive 19) python/ray/experimental/channel/common.py:456— AwaitableBackgroundReader._run has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (13 pts), error handling 1 (3 pts), loops 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AlgorithmConfig.callbacks (cognitive 19) python/ray/rllib/algorithms/algorithm_config.py:2740— AlgorithmConfig.callbacks has cognitive complexity 19 (threshold 15). Drivers by points: if/else 18 (19 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.
EpisodeV2.postprocess_episode (cognitive 19) python/ray/rllib/evaluation/episode_v2.py:253— EpisodeV2.postprocess_episode has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 2, 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.
EagerTFPolicyV2._compute_actions_helper (cognitive 19) python/ray/rllib/policy/eager_tf_policy_v2.py:763— EagerTFPolicyV2._compute_actions_helper has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (12 pts), loops 1 (4 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.
EagerTFPolicyV2._compute_gradients_helper (cognitive 19) python/ray/rllib/policy/eager_tf_policy_v2.py:868— EagerTFPolicyV2._compute_gradients_helper has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (14 pts), loops 2 (5 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SampleBatch.__init__ (cognitive 19) python/ray/rllib/policy/sample_batch.py:158— SampleBatch.__init__ has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 9, if/else 7 (9 pts), 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.
MultiAgentEpisodeReplayBuffer._sample_independent (cognitive 19) python/ray/rllib/utils/replay_buffers/multi_agent_episode_buffer.py:635— MultiAgentEpisodeReplayBuffer._sample_independent has cognitive complexity 19 (threshold 15). Drivers by points: if/else 2 (6 pts), ternaries 2 (6 pts), boolean chains 4, 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.
MultiAgentPrioritizedEpisodeReplayBuffer._sample_independent (cognitive 19) python/ray/rllib/utils/replay_buffers/multi_agent_prioritized_episode_buffer.py:820— MultiAgentPrioritizedEpisodeReplayBuffer._sample_independent has cognitive complexity 19 (threshold 15). Drivers by points: if/else 2 (6 pts), ternaries 2 (6 pts), boolean chains 4, 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.
PrioritizedEpisodeReplayBuffer.sample (cognitive 19) python/ray/rllib/utils/replay_buffers/prioritized_episode_buffer.py:361— PrioritizedEpisodeReplayBuffer.sample has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 4 (8 pts), if/else 4 (7 pts), boolean chains 3, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
scripts.continue_debug_session (cognitive 19) python/ray/scripts/scripts.py:278— scripts.continue_debug_session has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (14 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UserCallableWrapper._call_func_or_gen (cognitive 19) REDACTED:3930— UserCallableWrapper._call_func_or_gen has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 5, ternaries 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.
UserCallableWrapper._call_http_entrypoint (cognitive 19) REDACTED:4358— UserCallableWrapper._call_http_entrypoint has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 3, error handling 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.
RequestRouter._select_from_candidate_replicas (cognitive 19) python/ray/serve/_private/request_router/request_router.py:1068— RequestRouter._select_from_candidate_replicas has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 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.
api._run_many (cognitive 19) python/ray/serve/api.py:820— api._run_many has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 2 (4 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.
check_circular_imports.check_violations (cognitive 19) python/ray/train/lint/check_circular_imports.py:294— check_circular_imports.check_violations has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (10 pts), loops 3 (6 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.
PopulationBasedTraining._checkpoint_or_exploit (cognitive 19) python/ray/tune/schedulers/pbt.py:683— PopulationBasedTraining._checkpoint_or_exploit has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (18 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.
callback._create_default_callbacks (cognitive 19) python/ray/tune/utils/callback.py:35— callback._create_default_callbacks has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), error handling 1 (3 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.
RayNativeRuntime.start (cognitive 19) java/runtime/src/main/java/io/ray/runtime/RayNativeRuntime.java:59— RayNativeRuntime.start has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (9 pts), error handling 2 (4 pts), ternaries 3 (4 pts), boolean chains 2 (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.
LogVirtualView.value2react (cognitive 19) python/ray/dashboard/client/src/components/LogView/LogVirtualView.tsx:26— LogVirtualView.value2react has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 1 (3 pts), boolean chains 1, match/switch 1 (nesting depth added 11). 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.
JobStatus.JobStatusIcon (cognitive 19) python/ray/dashboard/client/src/common/JobStatus.tsx:58— JobStatus.JobStatusIcon has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 9 (18 pts), match/switch 1 (nesting depth added 9). 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.
AnyscaleJobRunner._handle_command_output (cognitive 18) release/ray_release/command_runner/anyscale_job_runner.py:163— AnyscaleJobRunner._handle_command_output has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 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.
custom_byod_build_init_helper.get_prerequisite_step (cognitive 18) release/ray_release/custom_byod_build_init_helper.py:183— custom_byod_build_init_helper.get_prerequisite_step has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (15 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
verify.main (cognitive 18) doc/.claude/skills/ray-soft-wrap/scripts/verify.py:87— verify.main has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 4, 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.
worker.wait (cognitive 18) REDACTED:3107— worker.wait has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 4, loops 1, 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.
NPUTorchDeviceManager.get_devices (cognitive 18) python/ray/air/_internal/device_manager/npu.py:41— NPUTorchDeviceManager.get_devices has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), error handling 1 (4 pts), loops 1 (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.
CometLoggerCallback.log_trial_save (cognitive 18) python/ray/air/integrations/comet.py:226— CometLoggerCallback.log_trial_save has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (7 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.
config._configure_key_pair (cognitive 18) REDACTED:381— config._configure_key_pair has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (15 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.
StandardAutoscaler.summary (cognitive 18) python/ray/autoscaler/_private/autoscaler.py:1477— StandardAutoscaler.summary has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 4 (5 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cluster_dump.get_local_ray_processes (cognitive 18) python/ray/autoscaler/_private/cluster_dump.py:245— cluster_dump.get_local_ray_processes has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 4 (5 pts), 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.
commands.exec_cluster (cognitive 18) python/ray/autoscaler/_private/commands.py:1177— commands.exec_cluster has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 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.
KubeRayIPPRProvider.do_ippr_requests (cognitive 18) python/ray/autoscaler/v2/instance_manager/cloud_providers/kuberay/ippr_provider.py:272— KubeRayIPPRProvider.do_ippr_requests has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (11 pts), boolean chains 3, error handling 1 (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.
Reconciler._fill_autoscaling_state (cognitive 18) python/ray/autoscaler/v2/instance_manager/reconciler.py:1545— Reconciler._fill_autoscaling_state has cognitive complexity 18 (threshold 15). Drivers by points: loops 7 (9 pts), ternaries 3 (6 pts), if/else 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.
DAGNode._get_toplevel_child_nodes (cognitive 18) python/ray/dag/dag_node.py:401— DAGNode._get_toplevel_child_nodes has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 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.
DashboardAgent.run (cognitive 18) python/ray/dashboard/agent.py:204— DashboardAgent.run has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9, ternaries 3 (5 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
LogsManager._resolve_actor_filename (cognitive 18) python/ray/dashboard/modules/log/log_manager.py:200— LogsManager._resolve_actor_filename has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 2, error handling 1 (2 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.
transform_pyarrow._try_normalize_take_indices (cognitive 18) python/ray/data/_internal/arrow_ops/transform_pyarrow.py:329— transform_pyarrow._try_normalize_take_indices has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3, 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, 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.
transform_pyarrow._concat_mismatched_blocks (cognitive 18) python/ray/data/_internal/arrow_ops/transform_pyarrow.py:1302— transform_pyarrow._concat_mismatched_blocks has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (4 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClickHouseDatasink._table_exists (cognitive 18) python/ray/data/_internal/datasource/clickhouse_datasink.py:247— ClickHouseDatasink._table_exists has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (8 pts), error handling 2 (4 pts), ternaries 1 (4 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.
disk_shuffle_tasks._disk_shuffle_map_task (cognitive 18) REDACTED:71— disk_shuffle_tasks._disk_shuffle_map_task has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), error handling 2 (3 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GPUAggregationPlan.partial_aggregate (cognitive 18) REDACTED:1128— GPUAggregationPlan.partial_aggregate has cognitive complexity 18 (threshold 15). Drivers by points: loops 5 (12 pts), if/else 3 (4 pts), ternaries 1 (2 pts) (nesting depth added 9). 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.
FuseOperators._get_fused_map_operator (cognitive 18) python/ray/data/_internal/logical/rules/operator_fusion.py:594— FuseOperators._get_fused_map_operator has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 9, if/else 7, loops 1, ternaries 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.
progress.get_progress_manager (cognitive 18) python/ray/data/_internal/progress/__init__.py:16— progress.get_progress_manager has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 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.
TqdmExecutionProgressManager.__init__ (cognitive 18) python/ray/data/_internal/progress/tqdm_progress.py:54— TqdmExecutionProgressManager.__init__ has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
util.iterate_with_retry (cognitive 18) python/ray/data/_internal/util.py:1634— util.iterate_with_retry has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 2 (3 pts), boolean chains 2, 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.
Dataset.split (cognitive 18) REDACTED:2741— Dataset.split has cognitive complexity 18 (threshold 15). Drivers by points: loops 7 (10 pts), if/else 5, boolean chains 3 (nesting depth added 3). 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.
Dataset._base_schema (cognitive 18) REDACTED:4633— Dataset._base_schema has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 3, 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.
expressions.expand_star_exprs (cognitive 18) python/ray/data/expressions.py:2107— expressions.expand_star_exprs has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (6 pts), loops 3 (5 pts), ternaries 1 (4 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NixlTensorTransport._add_tensor_descs (cognitive 18) python/ray/experimental/rdt/nixl_tensor_transport.py:720— NixlTensorTransport._add_tensor_descs has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (12 pts), error handling 1 (2 pts), ternaries 1 (2 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.
utils._sanitize_chat_completion_request (cognitive 18) python/ray/llm/_internal/serve/core/ingress/utils.py:30— utils._sanitize_chat_completion_request has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), error handling 2 (7 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.
PrefixCacheAffinityRouter._send_tree_lookup_if_balanced (cognitive 18) python/ray/llm/_internal/serve/routing_policies/prefix_aware/prefix_aware_router.py:237— PrefixCacheAffinityRouter._send_tree_lookup_if_balanced has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PrefixTree.prefix_match (cognitive 18) python/ray/llm/_internal/serve/routing_policies/prefix_aware/prefix_tree.py:376— PrefixTree.prefix_match has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (16 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.
TorchCNNTranspose.__init__ (cognitive 18) python/ray/rllib/core/models/torch/primitives.py:337— TorchCNNTranspose.__init__ has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 5, 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.
SyncSampler.__init__ (cognitive 18) python/ray/rllib/evaluation/sampler.py:113— SyncSampler.__init__ has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (18 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.
FullyConnectedNetwork.__init__ (cognitive 18) python/ray/rllib/models/tf/fcnet.py:20— FullyConnectedNetwork.__init__ has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (11 pts), loops 2 (3 pts), boolean chains 2, ternaries 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.
TFPolicy._build_compute_actions (cognitive 18) python/ray/rllib/policy/tf_policy.py:1035— TFPolicy._build_compute_actions has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 2 (4 pts), ternaries 2, 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.
SeriesStats.peek (cognitive 18) python/ray/rllib/utils/metrics/stats/series.py:171— SeriesStats.peek has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (18 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.
zero_padding.split_and_zero_pad (cognitive 18) python/ray/rllib/utils/postprocessing/zero_padding.py:50— zero_padding.split_and_zero_pad has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RunnerGroup.sync_weights (cognitive 18) python/ray/rllib/utils/runners/runner_group.py:378— RunnerGroup.sync_weights has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 2 (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.
tf_utils.get_placeholder (cognitive 18) python/ray/rllib/utils/tf_utils.py:233— tf_utils.get_placeholder has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 5 (8 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.
DeploymentState.deploy (cognitive 18) python/ray/serve/_private/deployment_state.py:3967— DeploymentState.deploy has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 4, 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.
ReplicaMetricsManager._report_cached_metrics (cognitive 18) REDACTED:607— ReplicaMetricsManager._report_cached_metrics has cognitive complexity 18 (threshold 15). Drivers by points: loops 10 (17 pts), if/else 1 (nesting depth added 7). 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.
Replica._record_errors_and_metrics (cognitive 18) REDACTED:1476— Replica._record_errors_and_metrics has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 4, ternaries 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.
gRPCReplicaResult.get_rejection_response (cognitive 18) REDACTED:448— gRPCReplicaResult.get_rejection_response has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 2, 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.
AsyncioRouter._route_and_send_request_once (cognitive 18) python/ray/serve/_private/router.py:1024— AsyncioRouter._route_and_send_request_once has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 3, error handling 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DeploymentSchema.validate_gang_scheduling_config (cognitive 18) python/ray/serve/schema.py:596— DeploymentSchema.validate_gang_scheduling_config has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 1 (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.
RASPoller._run (cognitive 18) python/ray/train/v2/_internal/callbacks/nccl_ras.py:495— RASPoller._run has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (9 pts), error handling 2 (4 pts), ternaries 1 (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.
TrainStateActor._abort_live_runs_with_dead_controllers (cognitive 18) python/ray/train/v2/_internal/state/state_actor.py:73— TrainStateActor._abort_live_runs_with_dead_controllers has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (4 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ExperimentAnalysis.get_best_trial (cognitive 18) python/ray/tune/analysis/experiment_analysis.py:482— ExperimentAnalysis.get_best_trial has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 3, 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.
BayesOptSearch.suggest (cognitive 18) REDACTED:273— BayesOptSearch.suggest has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (15 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.
variant_generator._get_preset_variants (cognitive 18) REDACTED:304— variant_generator._get_preset_variants has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (15 pts), 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.
util.validate_warmstart (cognitive 18) python/ray/tune/utils/util.py:613— util.validate_warmstart has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 2, loops 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.
LogstreamClient._log_main (cognitive 18) python/ray/util/client/logsclient.py:45— LogstreamClient._log_main has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (11 pts), error handling 2 (4 pts), 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.
Worker.get (cognitive 18) REDACTED:519— Worker.get has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (14 pts), error handling 1 (2 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.
ParallelActorCallGenerator.buildPyCalls (cognitive 18) java/runtime/src/main/java/io/ray/runtime/util/generator/ParallelActorCallGenerator.java:222— ParallelActorCallGenerator.buildPyCalls has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 7 (9 pts), if/else 8, 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.
RayCallGenerator.buildCppCalls (cognitive 18) java/runtime/src/main/java/io/ray/runtime/util/generator/RayCallGenerator.java:341— RayCallGenerator.buildCppCalls has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 7 (9 pts), if/else 8, 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. This shape REPEATS in the file: one other method here (RayCallGenerator.buildPyCalls) 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.
RayCallGenerator.buildPyCalls (cognitive 18) java/runtime/src/main/java/io/ray/runtime/util/generator/RayCallGenerator.java:284— RayCallGenerator.buildPyCalls has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 7 (9 pts), if/else 8, 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. This shape REPEATS in the file: one other method here (RayCallGenerator.buildCppCalls) 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.
glue.run_release_test_anyscale (cognitive 17) release/ray_release/glue.py:451— glue.run_release_test_anyscale has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), error handling 2 (4 pts), boolean chains 2, 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.
KubeRayJobManager._wait_job (cognitive 17) release/ray_release/job_manager/kuberay_job_manager.py:93— KubeRayJobManager._wait_job has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (15 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.
pytest_checker.get_paths_from_parsed_data (cognitive 17) ci/lint/pytest_checker.py:33— pytest_checker.get_paths_from_parsed_data 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.
Autodoc._parse_autodoc_rst (cognitive 17) ci/ray_ci/doc/autodoc.py:181— Autodoc._parse_autodoc_rst has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FunctionActorManager._wait_for_function (cognitive 17) REDACTED:427— FunctionActorManager._wait_for_function has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (16 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.
packaging.untar_package (cognitive 17) REDACTED:1267— packaging.untar_package has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 2, error handling 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.
OpenTelemetryMetricRecorder.record_histogram_aggregated_batch (cognitive 17) python/ray/_private/telemetry/open_telemetry_metric_recorder.py:393— OpenTelemetryMetricRecorder.record_histogram_aggregated_batch has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 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.
AzureNodeProvider._get_zones_for_vm_size (cognitive 17) python/ray/autoscaler/_private/_azure/node_provider.py:209— AzureNodeProvider._get_zones_for_vm_size has cognitive complexity 17 (threshold 15). Drivers by points: if/else 2 (6 pts), ternaries 1 (5 pts), loops 2 (4 pts), boolean chains 1, 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.
StandardAutoscaler._update (cognitive 17) python/ray/autoscaler/_private/autoscaler.py:379— StandardAutoscaler._update has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (14 pts), 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.
StandardAutoscaler.terminate_nodes_to_enforce_config_constraints (cognitive 17) python/ray/autoscaler/_private/autoscaler.py:475— StandardAutoscaler.terminate_nodes_to_enforce_config_constraints has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 3, loops 2 (3 pts), 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.
StandardAutoscaler._get_nodes_needed_for_request_resources (cognitive 17) python/ray/autoscaler/_private/autoscaler.py:907— StandardAutoscaler._get_nodes_needed_for_request_resources has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 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.
AWSNodeProvider.terminate_nodes (cognitive 17) python/ray/autoscaler/_private/aws/node_provider.py:539— AWSNodeProvider.terminate_nodes has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 3 (5 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.
config._validate_tpu_config (cognitive 17) python/ray/autoscaler/_private/gcp/config.py:87— config._validate_tpu_config has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 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.
resource_demand_scheduler.get_bin_pack_residual (cognitive 17) python/ray/autoscaler/_private/resource_demand_scheduler.py:881— resource_demand_scheduler.get_bin_pack_residual has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (13 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.
resource_demand_scheduler.placement_groups_to_resource_demands (cognitive 17) python/ray/autoscaler/_private/resource_demand_scheduler.py:976— resource_demand_scheduler.placement_groups_to_resource_demands has cognitive complexity 17 (threshold 15). Drivers by points: loops 4 (10 pts), if/else 3 (6 pts), boolean chains 1 (nesting depth added 9). 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.
NodeUpdater.wait_ready (cognitive 17) python/ray/autoscaler/_private/updater.py:282— NodeUpdater.wait_ready has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (12 pts), error handling 2 (4 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.
util.get_per_node_breakdown (cognitive 17) python/ray/autoscaler/_private/util.py:809— util.get_per_node_breakdown has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 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.
Reconciler._handle_stuck_instances (cognitive 17) python/ray/autoscaler/v2/instance_manager/reconciler.py:1077— Reconciler._handle_stuck_instances has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 7 (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.
cloudpickle._find_imported_submodules (cognitive 17) REDACTED:338— cloudpickle._find_imported_submodules has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (11 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dag_node_operation._select_next_nodes (cognitive 17) python/ray/dag/dag_node_operation.py:328— dag_node_operation._select_next_nodes has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 4 (5 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.
DataOrganizer._get_actor_info (cognitive 17) python/ray/dashboard/modules/node/datacenter.py:205— DataOrganizer._get_actor_info has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 3 (7 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.
KubernetesEventProvider._run_kuberay_resource_events_watch (cognitive 17) python/ray/dashboard/modules/platform_events/providers/k8s_provider.py:245— KubernetesEventProvider._run_kuberay_resource_events_watch has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), error handling 2 (4 pts), loops 2 (3 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.
transform_pyarrow._reconcile_diverging_fields (cognitive 17) python/ray/data/_internal/arrow_ops/transform_pyarrow.py:485— transform_pyarrow._reconcile_diverging_fields has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 3 (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.
transform_pyarrow._align_struct_fields (cognitive 17) python/ray/data/_internal/arrow_ops/transform_pyarrow.py:891— transform_pyarrow._align_struct_fields has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 3 (5 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.
WebDatasetDatasink.write_block_to_file (cognitive 17) python/ray/data/_internal/datasource/webdataset_datasink.py:37— WebDatasetDatasink.write_block_to_file has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (12 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.
hive_hs2.infer_table_schema (cognitive 17) python/ray/data/_internal/datasource_v2/formats/hive/hive_hs2.py:66— hive_hs2.infer_table_schema has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 2, ternaries 1 (2 pts), 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.
PhysicalOperator._apply_transform (cognitive 17) REDACTED:716— PhysicalOperator._apply_transform has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 3 (5 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OutputSplitter._split_from_buffer (cognitive 17) python/ray/data/_internal/execution/operators/output_splitter.py:385— OutputSplitter._split_from_buffer has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 3 (8 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.
DiskHashShuffleMapOp._handle_map_done (cognitive 17) python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_map_operator.py:272— DiskHashShuffleMapOp._handle_map_done has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 3 (5 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.
PredicatePushdown._can_push_filter_through_projection (cognitive 17) python/ray/data/_internal/logical/rules/predicate_pushdown.py:106— PredicatePushdown._can_push_filter_through_projection has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 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.
expression_evaluator._eval_projection_without_cse (cognitive 17) python/ray/data/_internal/planner/plan_expression/expression_evaluator.py:824— expression_evaluator._eval_projection_without_cse has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 3 (5 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.
LoggingExecutionProgressManager.__init__ (cognitive 17) python/ray/data/_internal/progress/logging_progress.py:101— LoggingExecutionProgressManager.__init__ has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (3 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.
TensorArray.__init__ (cognitive 17) python/ray/data/_internal/tensor_extensions/pandas.py:733— TensorArray.__init__ has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 2, ternaries 1 (2 pts) (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.
Dataset.to_dask (cognitive 17) REDACTED:7388— Dataset.to_dask has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (7 pts), ternaries 2 (7 pts), loops 2 (3 pts) (nesting depth added 9). 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.
Dataset._execute (cognitive 17) REDACTED:8461— Dataset._execute has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (14 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.
data_batch_conversion._cast_ndarray_columns_to_tensor_extension (cognitive 17) python/ray/data/util/data_batch_conversion.py:245— data_batch_conversion._cast_ndarray_columns_to_tensor_extension has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), error handling 1 (3 pts), ternaries 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.
_BarManager._process_state_update_locked (cognitive 17) python/ray/experimental/tqdm_ray.py:316— _BarManager._process_state_update_locked has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (17 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.
Algorithm.step (cognitive 17) REDACTED:1185— Algorithm.step has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (11 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.
Algorithm._evaluate_on_local_env_runner (cognitive 17) REDACTED:1766— Algorithm._evaluate_on_local_env_runner has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 2 (4 pts), loops 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.
Algorithm.get_state (cognitive 17) REDACTED:3222— Algorithm.get_state has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (16 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.
AlgorithmConfig._serialize_dict (cognitive 17) python/ray/rllib/algorithms/algorithm_config.py:5673— AlgorithmConfig._serialize_dict has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (16 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.
APPOTorchPolicy.loss (cognitive 17) python/ray/rllib/algorithms/appo/appo_torch_policy.py:118— APPOTorchPolicy.loss has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (13 pts), ternaries 2 (4 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.
LearnerGroup.update (cognitive 17) python/ray/rllib/core/learner/learner_group.py:256— LearnerGroup.update has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (16 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.
TorchLearner.build (cognitive 17) python/ray/rllib/core/learner/torch/torch_learner.py:473— TorchLearner.build has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 1 (4 pts) (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
TorchCNN.__init__ (cognitive 17) python/ray/rllib/core/models/torch/primitives.py:200— TorchCNN.__init__ has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (14 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.
RLModuleSpec.update (cognitive 17) python/ray/rllib/core/rl_module/rl_module.py:196— RLModuleSpec.update has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 14, if/else 3. 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.
TorchRLModule.__init__ (cognitive 17) python/ray/rllib/core/rl_module/torch/torch_rl_module.py:48— TorchRLModule.__init__ has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 2 (5 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RolloutWorker.compute_gradients (cognitive 17) REDACTED:869— RolloutWorker.compute_gradients has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 2 (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.
RolloutWorker.set_state (cognitive 17) REDACTED:1405— RolloutWorker.set_state has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 2 (5 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.
dataset_reader.get_dataset_and_shards (cognitive 17) python/ray/rllib/offline/dataset_reader.py:71— dataset_reader.get_dataset_and_shards has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 6 (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.
EpsilonGreedy._get_torch_exploration_action (cognitive 17) python/ray/rllib/utils/exploration/epsilon_greedy.py:168— EpsilonGreedy._get_torch_exploration_action has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 2 (8 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.
EmaStats.peek (cognitive 17) python/ray/rllib/utils/metrics/stats/ema.py:144— EmaStats.peek has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (15 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.
EpisodeReplayBuffer._sample_batch (cognitive 17) python/ray/rllib/utils/replay_buffers/episode_replay_buffer.py:638— EpisodeReplayBuffer._sample_batch has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 4, 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.
ApplicationStateManager.update (cognitive 17) python/ray/serve/_private/application_state.py:1587— ApplicationStateManager.update has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 5, loops 3 (4 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.
ReplicaConfig.create (cognitive 17) python/ray/serve/_private/config.py:806— ReplicaConfig.create has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (14 pts), 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, 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.
ServeController.shutdown (cognitive 17) REDACTED:1138— ServeController.shutdown 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.
DeploymentScheduler._schedule_replica (cognitive 17) python/ray/serve/_private/deployment_scheduler.py:701— DeploymentScheduler._schedule_replica has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), error handling 3 (6 pts), 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.
DeploymentScheduler._update_compacting_node_info (cognitive 17) python/ray/serve/_private/deployment_scheduler.py:1587— DeploymentScheduler._update_compacting_node_info has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 2, 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.
DeploymentState.scale_deployment_replicas (cognitive 17) python/ray/serve/_private/deployment_state.py:4624— DeploymentState.scale_deployment_replicas has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (11 pts), ternaries 2 (4 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.
DeploymentState.check_curr_status (cognitive 17) python/ray/serve/_private/deployment_state.py:4872— DeploymentState.check_curr_status has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (14 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.
DefaultFailurePolicy.make_decision (cognitive 17) python/ray/train/v2/_internal/execution/failure_handling/default.py:93— DefaultFailurePolicy.make_decision has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 3 (9 pts), if/else 6 (8 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.
variant_generator._resolve_domain_vars (cognitive 17) REDACTED:391— variant_generator._resolve_domain_vars has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (7 pts), error handling 2 (6 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
check_serialize._inspect_generic_serialization (cognitive 17) python/ray/util/check_serialize.py:123— check_serialize._inspect_generic_serialization has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (7 pts), boolean chains 4, ternaries 2 (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.
nccl_collective_group._check_inputs_compatibility_for_scatter_gather (cognitive 17) python/ray/util/collective/collective_group/nccl_collective_group.py:722— nccl_collective_group._check_inputs_compatibility_for_scatter_gather has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (3 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.
placement_group._validate_bundle_label_selector (cognitive 17) python/ray/util/placement_group.py:517— placement_group._validate_bundle_label_selector has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ServeControllerClient.deleteApps (cognitive 17) java/serve/src/main/java/io/ray/serve/api/ServeControllerClient.java:271— ServeControllerClient.deleteApps has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 2 (5 pts), error handling 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.
JobRow.JobRow (cognitive 17) python/ray/dashboard/client/src/pages/job/JobRow.tsx:21— JobRow.JobRow has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 7 (8 pts), boolean chains 5, if/else 4 (nesting depth added 1). Of this number, 11 points are the body's own statements and 6 belong to one function literal inside it that branches. 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.StateApiLogsFilesList (cognitive 17) python/ray/dashboard/client/src/pages/log/Logs.tsx:128— Logs.StateApiLogsFilesList has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 11 (13 pts), boolean chains 4 (nesting depth added 2). Of this number, 12 points are the body's own statements and 5 belong to 2 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.
get_contributors.run (cognitive 16) ci/ray_ci/automation/get_contributors.py:50— get_contributors.run has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), loops 4 (5 pts), 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.
cmd_check_api_discrepancy._check_team (cognitive 16) ci/ray_ci/doc/cmd_check_api_discrepancy.py:455— cmd_check_api_discrepancy._check_team has cognitive complexity 16 (threshold 15). Drivers by points: loops 6 (11 pts), if/else 5 (nesting depth added 5). 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.
Module._walk (cognitive 16) ci/ray_ci/doc/module.py:37— Module._walk has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (15 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.
DockerContainer._get_image_tags (cognitive 16) ci/ray_ci/docker_container.py:144— DockerContainer._get_image_tags has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 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.
sphinx_fix._strip_comment (cognitive 16) doc/.claude/skills/sphinx-fix/sphinx_fix.py:117— sphinx_fix._strip_comment has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 3, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
sphinx_fix.run_selftest (cognitive 16) doc/.claude/skills/sphinx-fix/sphinx_fix.py:1017— sphinx_fix.run_selftest has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 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.
usage_lib.show_usage_stats_prompt (cognitive 16) python/ray/_common/usage/usage_lib.py:438— usage_lib.show_usage_stats_prompt has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), error handling 1 (3 pts), ternaries 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.
dict.deep_update (cognitive 16) python/ray/_private/dict.py:27— dict.deep_update has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 6, 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.
dict.unflatten_list_dict (cognitive 16) python/ray/_private/dict.py:175— dict.unflatten_list_dict has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (9 pts), ternaries 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.
packaging.get_top_level_dir_from_compressed_package (cognitive 16) REDACTED:1023— packaging.get_top_level_dir_from_compressed_package has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (14 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.
GlobalState.chrome_tracing_object_transfer_dump (cognitive 16) python/ray/_private/state.py:674— GlobalState.chrome_tracing_object_transfer_dump has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 3 (4 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.
CometLoggerCallback.log_trial_result (cognitive 16) python/ray/air/integrations/comet.py:170— CometLoggerCallback.log_trial_result has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 4, boolean chains 2 (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.
wandb._set_api_key (cognitive 16) REDACTED:331— wandb._set_api_key has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), error handling 2 (5 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.
config._usable_subnet_ids (cognitive 16) python/ray/autoscaler/_private/aws/config.py:466— config._usable_subnet_ids has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 2, error handling 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.
AWSNodeProvider.create_node (cognitive 16) python/ray/autoscaler/_private/aws/node_provider.py:256— AWSNodeProvider.create_node has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 2 (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.
ClusterOperatorClient.list_vms (cognitive 16) python/ray/autoscaler/_private/vsphere/cluster_operator_client.py:163— ClusterOperatorClient.list_vms has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 2 (4 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.
compiled_dag_node.do_exec_tasks (cognitive 16) python/ray/dag/compiled_dag_node.py:186— compiled_dag_node.do_exec_tasks has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), loops 3 (4 pts), error handling 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.
NvidiaGpuProvider._detect_ppu_devices (cognitive 16) python/ray/dashboard/modules/reporter/gpu_providers.py:195— NvidiaGpuProvider._detect_ppu_devices has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 3, loops 2, 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.
AmdGpuProvider.get_gpu_utilization (cognitive 16) python/ray/dashboard/modules/reporter/gpu_providers.py:577— AmdGpuProvider.get_gpu_utilization has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), error handling 2 (3 pts), loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
task_event_query._select_candidates (cognitive 16) python/ray/dashboard/modules/task_events/task_event_query.py:82— task_event_query._select_candidates has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (16 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.
transform_pyarrow._reconcile_field (cognitive 16) python/ray/data/_internal/arrow_ops/transform_pyarrow.py:545— transform_pyarrow._reconcile_field has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
transform_pyarrow._concat_cols_with_null_list (cognitive 16) python/ray/data/_internal/arrow_ops/transform_pyarrow.py:997— transform_pyarrow._concat_cols_with_null_list has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (3 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.
transform_pyarrow.to_numpy (cognitive 16) python/ray/data/_internal/arrow_ops/transform_pyarrow.py:1429— transform_pyarrow.to_numpy has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (16 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.
clickhouse_datasink._arrow_to_clickhouse_type (cognitive 16) python/ray/data/_internal/datasource/clickhouse_datasink.py:46— clickhouse_datasink._arrow_to_clickhouse_type has cognitive complexity 16 (threshold 15). Drivers by points: if/else 14, boolean chains 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.
IcebergDatasink._commit_upsert_scan_merge (cognitive 16) REDACTED:628— IcebergDatasink._commit_upsert_scan_merge has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), loops 6 (7 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.
lerobot_datasource._build_delta_batch (cognitive 16) python/ray/data/_internal/datasource/lerobot_datasource.py:1033— lerobot_datasource._build_delta_batch has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 4, 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.
parquet_datasink._widen_offset_overflowing_columns (cognitive 16) python/ray/data/_internal/datasource/parquet_datasink.py:107— parquet_datasink._widen_offset_overflowing_columns has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (4 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.
tfrecords_datasource._read_records (cognitive 16) python/ray/data/_internal/datasource/tfrecords_datasource.py:185— tfrecords_datasource._read_records has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), error handling 1 (2 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.
RefBundle.slice (cognitive 16) python/ray/data/_internal/execution/interfaces/ref_bundle.py:284— RefBundle.slice has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2, ternaries 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hash_shuffle._shuffle_block (cognitive 16) REDACTED:249— hash_shuffle._shuffle_block has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 2, 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.
DiskHashShuffleMapOp._teardown_shuffle (cognitive 16) python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_map_operator.py:446— DiskHashShuffleMapOp._teardown_shuffle has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), error handling 3 (6 pts), loops 2, 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.
disk_shuffle_runtime._handles_to_sources (cognitive 16) python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_runtime.py:721— disk_shuffle_runtime._handles_to_sources has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), ternaries 2 (4 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.
StreamingExecutor.shutdown (cognitive 16) python/ray/data/_internal/execution/streaming_executor.py:380— StreamingExecutor.shutdown has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, loops 3 (5 pts), boolean chains 1, 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.
GPUAggregationPlan.merge_input_schema (cognitive 16) REDACTED:1233— GPUAggregationPlan.merge_input_schema has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), error handling 2 (5 pts), boolean chains 1, loops 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Read._cached_output_metadata (cognitive 16) python/ray/data/_internal/logical/operators/read_operator.py:132— Read._cached_output_metadata has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 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, 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.
_TreeReprVisitor._make_tree_lines (cognitive 16) python/ray/data/_internal/planner/plan_expression/expression_visitors.py:456— _TreeReprVisitor._make_tree_lines has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 2 (6 pts), if/else 3 (5 pts), loops 2 (5 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.
RichExecutionProgressManager.close_with_finishing_description (cognitive 16) python/ray/data/_internal/progress/rich_progress.py:271— RichExecutionProgressManager.close_with_finishing_description has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (6 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.
arrow.convert_to_pyarrow_array (cognitive 16) python/ray/data/_internal/tensor_extensions/arrow.py:284— arrow.convert_to_pyarrow_array has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 6, 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.
Quantile.combine (cognitive 16) REDACTED:1088— Quantile.combine has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 7 (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.
Dataset.to_pandas (cognitive 16) REDACTED:7591— Dataset.to_pandas has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), error handling 1 (4 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.
Dataset._build_multicolumn_aggs (cognitive 16) REDACTED:8170— Dataset._build_multicolumn_aggs has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 1 (nesting depth added 8). 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.
DataType.to_cudf_type (cognitive 16) python/ray/data/datatype.py:241— DataType.to_cudf_type has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 2, 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.
stats._build_summary_table (cognitive 16) python/ray/data/stats.py:589— stats._build_summary_table has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (3 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.
torch_utils.arrow_batch_to_tensors (cognitive 16) python/ray/data/util/torch_utils.py:243— torch_utils.arrow_batch_to_tensors has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), loops 1 (3 pts), ternaries 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.
CudaIpcTransport.recv_multiple_tensors (cognitive 16) python/ray/experimental/rdt/cuda_ipc_transport.py:116— CudaIpcTransport.recv_multiple_tensors has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), error handling 2 (5 pts), loops 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.
NixlTensorTransport.wait_fetch_complete (cognitive 16) python/ray/experimental/rdt/nixl_tensor_transport.py:555— NixlTensorTransport.wait_fetch_complete has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), error handling 2, 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.
LLMRouter.route (cognitive 16) REDACTED:184— LLMRouter.route has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), error handling 3 (4 pts), boolean chains 3 (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.
VLLMEngineConfig.placement_bundles (cognitive 16) python/ray/llm/_internal/serve/engines/vllm/vllm_models.py:272— VLLMEngineConfig.placement_bundles has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 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.
AlgorithmConfig.framework (cognitive 16) python/ray/rllib/algorithms/algorithm_config.py:1627— AlgorithmConfig.framework has cognitive complexity 16 (threshold 15). Drivers by points: if/else 15 (16 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.
AlgorithmConfig.learners (cognitive 16) python/ray/rllib/algorithms/algorithm_config.py:2355— AlgorithmConfig.learners has cognitive complexity 16 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 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.
AlgorithmConfig.fault_tolerance (cognitive 16) python/ray/rllib/algorithms/algorithm_config.py:4036— AlgorithmConfig.fault_tolerance has cognitive complexity 16 (threshold 15). Drivers by points: if/else 16. 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.
APPOConfig.training (cognitive 16) python/ray/rllib/algorithms/appo/appo.py:166— APPOConfig.training has cognitive complexity 16 (threshold 15). Drivers by points: if/else 16. 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.
DreamerModel.dream_trajectory_with_burn_in (cognitive 16) python/ray/rllib/algorithms/dreamerv3/torch/models/dreamer_model.py:411— DreamerModel.dream_trajectory_with_burn_in has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), loops 2, ternaries 1 (2 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.
IMPALALearner.update (cognitive 16) python/ray/rllib/algorithms/impala/impala_learner.py:192— IMPALALearner.update has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), error handling 2 (4 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
VTraceOptimizer.optimizer (cognitive 16) python/ray/rllib/algorithms/impala/impala_tf_policy.py:239— VTraceOptimizer.optimizer has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (16 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.
FlattenObservations.__call__ (cognitive 16) python/ray/rllib/connectors/common/flatten_observations.py:422— FlattenObservations.__call__ 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.
train_ops.multi_gpu_train_one_step (cognitive 16) python/ray/rllib/execution/train_ops.py:89— train_ops.multi_gpu_train_one_step has cognitive complexity 16 (threshold 15). Drivers by points: loops 5 (9 pts), if/else 4 (5 pts), boolean chains 2 (nesting depth added 5). 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.
FullyConnectedNetwork.__init__ (cognitive 16) python/ray/rllib/models/torch/fcnet.py:21— FullyConnectedNetwork.__init__ has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), loops 2 (3 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.
OfflineSingleAgentEnvRunner.sample (cognitive 16) python/ray/rllib/offline/offline_env_runner.py:162— OfflineSingleAgentEnvRunner.sample has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), loops 1 (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.
TFMultiGPUTowerStack.load_data (cognitive 16) python/ray/rllib/policy/dynamic_tf_policy.py:1109— TFMultiGPUTowerStack.load_data has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (12 pts), loops 2 (4 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.
TorchPolicy.compute_log_likelihoods (cognitive 16) python/ray/rllib/policy/torch_policy.py:356— TorchPolicy.compute_log_likelihoods has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 4, error handling 1 (2 pts) (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Checkpointable._restore_all_subcomponents_from_path (cognitive 16) REDACTED:641— Checkpointable._restore_all_subcomponents_from_path has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 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.
RayCLI.format_commands (cognitive 16) python/ray/scripts/scripts.py:154— RayCLI.format_commands has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
logging_utils.configure_component_logger (cognitive 16) python/ray/serve/_private/logging_utils.py:339— logging_utils.configure_component_logger has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 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.
utils._callable_uses_multiplexing (cognitive 16) python/ray/serve/_private/utils.py:58— utils._callable_uses_multiplexing has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 3 (5 pts), error handling 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.
_BatchQueue._consume_func_generator (cognitive 16) python/ray/serve/batching.py:400— _BatchQueue._consume_func_generator has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 4 (6 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.
DataConfig.configure (cognitive 16) python/ray/train/_internal/data_config.py:86— DataConfig.configure has cognitive complexity 16 (threshold 15). Drivers by points: loops 4 (8 pts), if/else 5 (7 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.
WorkerGroup._assign_worker_ranks (cognitive 16) python/ray/train/v2/_internal/execution/worker_group/worker_group.py:1098— WorkerGroup._assign_worker_ranks has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), loops 3 (5 pts), ternaries 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
config._setup_jax_distributed_environment (cognitive 16) python/ray/train/v2/jax/config.py:60— config._setup_jax_distributed_environment 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.
_Bracket.on_result (cognitive 16) REDACTED:245— _Bracket.on_result has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 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.
DistributeResources._add_two_bundles (cognitive 16) REDACTED:127— DistributeResources._add_two_bundles has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 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.
Trainable.train (cognitive 16) python/ray/tune/trainable/trainable.py:290— Trainable.train has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13 (15 pts), 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.
check_serialize._inspect_func_serialization (cognitive 16) python/ray/util/check_serialize.py:64— check_serialize._inspect_func_serialization has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Worker._call_stub (cognitive 16) REDACTED:378— Worker._call_stub has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (9 pts), error handling 2 (4 pts), boolean chains 2, 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.
cluster_init._preallocate_ray_worker_port_range (cognitive 16) REDACTED:303— cluster_init._preallocate_ray_worker_port_range has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), error handling 3 (4 pts), loops 2 (3 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.
setup.pip_run (cognitive 16) python/setup.py:649— setup.pip_run has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 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.
LocalModeObjectStore.waitInternal (cognitive 16) java/runtime/src/main/java/io/ray/runtime/object/LocalModeObjectStore.java:72— LocalModeObjectStore.waitInternal has cognitive complexity 16 (threshold 15). Drivers by points: if/else 2 (5 pts), error handling 1 (3 pts), loops 2 (3 pts), ternaries 1 (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.
LocalModeTaskSubmitter.submitTaskSpec (cognitive 16) REDACTED:403— LocalModeTaskSubmitter.submitTaskSpec has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), error handling 2 (3 pts), 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.
NetworkUtil.getIpAddress (cognitive 16) java/runtime/src/main/java/io/ray/runtime/util/NetworkUtil.java:15— NetworkUtil.getIpAddress has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (3 pts), boolean chains 2, 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.
SortableTableHead.SortableTableHead (cognitive 16) python/ray/dashboard/client/src/common/SortableTableHead.tsx:21— SortableTableHead.SortableTableHead has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 6 (13 pts), if/else 2, boolean chains 1 (nesting depth added 7). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to one function literal inside it that branches (line 30). 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.
MethodTooLong: RayConfig.<init> java/runtime/src/main/java/io/ray/runtime/config/RayConfig.java:102— MethodTooLong — <init> runs 104 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 4 over it, 1.04× 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.
D30 · Dependency Vulnerabilities· Medium vulnerability · ×1
D4 · Code Duplication· Near-duplicate member family (7 members, 15 shared lines) · ×1
Near-duplicate member family (7 members, 15 shared lines) REDACTED:378— REDACTED:378-408 | REDACTED:417-448 | REDACTED:540-570 | REDACTED:579-610 | REDACTED:704-734 | REDACTED:743-774 | REDACTED:868-902 — These 7 members are variants of one another: a block of 15 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 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.
Near-duplicate member pair (126 shared lines) python/ray/rllib/policy/torch_policy.py:1057— python/ray/rllib/policy/torch_policy.py:1057-1193 | python/ray/rllib/policy/torch_policy_v2.py:1142-1278 — These two members are variants of one another: 126 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 (95 shared lines) python/ray/llm/_internal/batch/processor/sglang_engine_proc.py:86— python/ray/llm/_internal/batch/processor/sglang_engine_proc.py:86-277 | python/ray/llm/_internal/batch/processor/vllm_engine_proc.py:125-357 — These two members are variants of one another: 95 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (65 shared lines) python/ray/rllib/policy/torch_policy.py:96— python/ray/rllib/policy/torch_policy.py:96-289 | python/ray/rllib/policy/torch_policy_v2.py:74-211 — These two members are variants of one another: 65 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (51 shared lines) python/ray/rllib/algorithms/cql/cql_tf_policy.py:91— python/ray/rllib/algorithms/cql/cql_tf_policy.py:91-284 | python/ray/rllib/algorithms/cql/cql_torch_policy.py:89-317 — These two members are variants of one another: 51 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 (50 shared lines) python/ray/rllib/models/tf/complex_input_net.py:37— python/ray/rllib/models/tf/complex_input_net.py:37-156 | python/ray/rllib/models/torch/complex_input_net.py:38-174 — These two members are variants of one another: 50 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 (34 corresponding lines) · ×1
Edited copy of a member (34 corresponding lines) python/ray/rllib/algorithms/sac/torch/sac_torch_learner.py:59— python/ray/rllib/algorithms/sac/torch/sac_torch_learner.py:59-113 | python/ray/rllib/algorithms/tqc/torch/tqc_torch_learner.py:97-144 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (23 corresponding lines) · ×1
Edited copy of a member (23 corresponding lines) python/ray/rllib/policy/dynamic_tf_policy.py:101— python/ray/rllib/policy/dynamic_tf_policy.py:101-482 | python/ray/rllib/policy/dynamic_tf_policy_v2.py:411-438 — These two members are one piece of code written twice and then edited apart: 23 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) · ×1
Members sharing a duplicated core (7 members, 50+ identical tokens) python/ray/dashboard/modules/job/job_agent.py:78— python/ray/dashboard/modules/job/job_agent.py:78-106 | python/ray/dashboard/modules/job/job_agent.py:111-139 | python/ray/dashboard/modules/job/job_agent.py:144-167 | python/ray/dashboard/modules/job/job_agent.py:172-196 | python/ray/dashboard/modules/job/job_head.py:449-477 | python/ray/dashboard/modules/job/job_head.py:481-509 | python/ray/dashboard/modules/job/job_head.py:570-603 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
D4 · Code Duplication· Members sharing a duplicated core (6 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (6 members, 50+ identical tokens) doc/source/serve/doc_code/develop_and_deploy.py:24— doc/source/serve/doc_code/develop_and_deploy.py:24-36 | doc/source/serve/doc_code/getting_started/model_deployment.py:24-36 | doc/source/serve/doc_code/getting_started/model_deployment_full.py:22-34 | doc/source/serve/doc_code/getting_started/models.py:16-28 | doc/source/serve/doc_code/getting_started/translator.py:23-35 | doc/source/serve/doc_code/getting_started/translator.py:49-59 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
D4 · Code Duplication· Members sharing a duplicated core (5 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (5 members, 50+ identical tokens) java/runtime/src/main/java/io/ray/runtime/util/generator/ConcurrencyGroupBuilderGenerator.java:71— java/runtime/src/main/java/io/ray/runtime/util/generator/ConcurrencyGroupBuilderGenerator.java:71-99 | java/runtime/src/main/java/io/ray/runtime/util/generator/ParallelActorCallGenerator.java:17-44 | java/runtime/src/main/java/io/ray/runtime/util/generator/ParallelActorCallGenerator.java:47-93 | java/runtime/src/main/java/io/ray/runtime/util/generator/RayCallGenerator.java:17-79 | java/runtime/src/main/java/io/ray/runtime/util/generator/RayCallGenerator.java:82-109 — 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 (126–134 lines × 2) REDACTED:448— REDACTED:448-581 | REDACTED:1904-2029 — both copies are in the same file, so extract the 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 (116–125 lines × 2) python/ray/rllib/utils/replay_buffers/multi_agent_episode_buffer.py:687— python/ray/rllib/utils/replay_buffers/multi_agent_episode_buffer.py:687-802 | python/ray/rllib/utils/replay_buffers/multi_agent_prioritized_episode_buffer.py:912-1036 — before extracting anything, compare `python/ray/rllib/utils/replay_buffers/multi_agent_episode_buffer.py` and `python/ray/rllib/utils/replay_buffers/multi_agent_prioritized_episode_buffer.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 417 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 `python/ray/rllib/utils/replay_buffers/multi_agent_prioritized_episode_buffer.py:912` it begins part-way through the construct above it, so those 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 (95–96 lines × 2) python/ray/rllib/policy/torch_policy.py:538— python/ray/rllib/policy/torch_policy.py:538-632 | python/ray/rllib/policy/torch_policy_v2.py:717-812 — before extracting anything, compare `python/ray/rllib/policy/torch_policy.py` and `python/ray/rllib/policy/torch_policy_v2.py` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 513 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 (51–90 lines × 2) python/ray/rllib/core/learner/learner.py:1099— python/ray/rllib/core/learner/learner.py:1099-1188 | python/ray/rllib/core/learner/torch/torch_meta_learner.py:120-170 — before extracting anything, compare `python/ray/rllib/core/learner/learner.py` and `python/ray/rllib/core/learner/torch/torch_meta_learner.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 171 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (35–88 lines × 2) python/ray/rllib/utils/replay_buffers/multi_agent_episode_buffer.py:370— python/ray/rllib/utils/replay_buffers/multi_agent_episode_buffer.py:370-457 | python/ray/rllib/utils/replay_buffers/multi_agent_prioritized_episode_buffer.py:543-577 — before extracting anything, compare `python/ray/rllib/utils/replay_buffers/multi_agent_episode_buffer.py` and `python/ray/rllib/utils/replay_buffers/multi_agent_prioritized_episode_buffer.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 417 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (81–84 lines × 2) python/ray/rllib/policy/dynamic_tf_policy.py:828— python/ray/rllib/policy/dynamic_tf_policy.py:828-911 | python/ray/rllib/policy/dynamic_tf_policy_v2.py:779-859 — before extracting anything, compare `python/ray/rllib/policy/dynamic_tf_policy.py` and `python/ray/rllib/policy/dynamic_tf_policy_v2.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 422 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 `python/ray/rllib/policy/dynamic_tf_policy.py:828` it begins part-way through the construct above it, so those 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 (82 lines × 2) python/ray/rllib/policy/dynamic_tf_policy.py:740— python/ray/rllib/policy/dynamic_tf_policy.py:740-821 | python/ray/rllib/policy/dynamic_tf_policy_v2.py:691-772 — before extracting anything, compare `python/ray/rllib/policy/dynamic_tf_policy.py` and `python/ray/rllib/policy/dynamic_tf_policy_v2.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 422 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–79 lines × 2) python/ray/serve/_private/api.py:166— python/ray/serve/_private/api.py:166-195 | python/ray/serve/_private/api.py:242-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. 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 (68–71 lines × 2) python/ray/rllib/utils/replay_buffers/multi_agent_episode_buffer.py:209— python/ray/rllib/utils/replay_buffers/multi_agent_episode_buffer.py:209-276 | python/ray/rllib/utils/replay_buffers/multi_agent_prioritized_episode_buffer.py:252-322 — before extracting anything, compare `python/ray/rllib/utils/replay_buffers/multi_agent_episode_buffer.py` and `python/ray/rllib/utils/replay_buffers/multi_agent_prioritized_episode_buffer.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 417 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 (65 lines × 2) python/ray/rllib/policy/dynamic_tf_policy.py:486— python/ray/rllib/policy/dynamic_tf_policy.py:486-550 | python/ray/rllib/policy/dynamic_tf_policy_v2.py:873-937 — before extracting anything, compare `python/ray/rllib/policy/dynamic_tf_policy.py` and `python/ray/rllib/policy/dynamic_tf_policy_v2.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 422 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 (60 lines × 2) python/ray/rllib/policy/torch_policy.py:1089— python/ray/rllib/policy/torch_policy.py:1089-1148 | python/ray/rllib/policy/torch_policy_v2.py:1175-1234 — before extracting anything, compare `python/ray/rllib/policy/torch_policy.py` and `python/ray/rllib/policy/torch_policy_v2.py` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 513 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 `python/ray/rllib/policy/torch_policy.py:1089` 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 (59 lines × 2) python/ray/rllib/policy/dynamic_tf_policy.py:657— python/ray/rllib/policy/dynamic_tf_policy.py:657-715 | python/ray/rllib/policy/dynamic_tf_policy_v2.py:486-544 — before extracting anything, compare `python/ray/rllib/policy/dynamic_tf_policy.py` and `python/ray/rllib/policy/dynamic_tf_policy_v2.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 422 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 (53–56 lines × 2) python/ray/rllib/core/models/torch/primitives.py:213— python/ray/rllib/core/models/torch/primitives.py:213-268 | python/ray/rllib/core/models/torch/primitives.py:350-402 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (53–54 lines × 2) python/ray/rllib/models/tf/attention_net.py:412— python/ray/rllib/models/tf/attention_net.py:412-465 | python/ray/rllib/models/torch/attention_net.py:284-336 — `python/ray/rllib/models/tf/attention_net.py` and `python/ray/rllib/models/torch/attention_net.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 5 separate duplicated blocks between them, totalling at least 114 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `python/ray/rllib/models/tf/attention_net.py:412` it begins part-way through the construct above it, so those 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, `python/ray/rllib/models/torch/attention_net.py:283` calls `__init__`, `super` and `python/ray/rllib/models/tf/attention_net.py:412` 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 (53 lines × 2) python/ray/rllib/utils/replay_buffers/multi_agent_prioritized_replay_buffer.py:152— python/ray/rllib/utils/replay_buffers/multi_agent_prioritized_replay_buffer.py:152-204 | python/ray/rllib/utils/replay_buffers/multi_agent_replay_buffer.py:237-289 — before extracting anything, compare `python/ray/rllib/utils/replay_buffers/multi_agent_prioritized_replay_buffer.py` and `python/ray/rllib/utils/replay_buffers/multi_agent_replay_buffer.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 80 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 (48–49 lines × 2) python/ray/rllib/policy/torch_policy.py:853— python/ray/rllib/policy/torch_policy.py:853-900 | python/ray/rllib/policy/torch_policy_v2.py:966-1014 — before extracting anything, compare `python/ray/rllib/policy/torch_policy.py` and `python/ray/rllib/policy/torch_policy_v2.py` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 513 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 `python/ray/rllib/policy/torch_policy.py:853` 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 (48 lines × 2) python/ray/train/_internal/state/state_actor.py:52— python/ray/train/_internal/state/state_actor.py:52-99 | python/ray/train/v2/_internal/state/state_actor.py:180-227 — 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 (47 lines × 2) python/ray/rllib/algorithms/algorithm_config.py:1279— python/ray/rllib/algorithms/algorithm_config.py:1279-1325 | python/ray/rllib/core/learner/differentiable_learner_config.py:95-141 — 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 (31–44 lines × 2) python/ray/dashboard/modules/reporter/reporter_head.py:357— python/ray/dashboard/modules/reporter/reporter_head.py:357-387 | python/ray/dashboard/modules/reporter/reporter_head.py:460-503 — both copies are in the same file, so extract the 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 (44 lines × 2) python/ray/rllib/algorithms/sac/sac_tf_model.py:186— python/ray/rllib/algorithms/sac/sac_tf_model.py:186-229 | python/ray/rllib/algorithms/sac/sac_torch_model.py:188-231 — before extracting anything, compare `python/ray/rllib/algorithms/sac/sac_tf_model.py` and `python/ray/rllib/algorithms/sac/sac_torch_model.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 93 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 (35–43 lines × 2) python/ray/data/_internal/datasource/tfrecords_datasink.py:120— python/ray/data/_internal/datasource/tfrecords_datasink.py:120-162 | python/ray/data/_internal/datasource/tfrecords_datasource.py:99-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.
Duplicated block (41–43 lines × 2) python/ray/rllib/algorithms/sac/torch/sac_torch_learner.py:220— python/ray/rllib/algorithms/sac/torch/sac_torch_learner.py:220-260 | python/ray/rllib/algorithms/sac/torch/sac_torch_learner.py:350-392 — both copies are in the same file, so extract the 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 `python/ray/rllib/algorithms/sac/torch/sac_torch_learner.py:220` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (27–42 lines × 3) python/ray/dashboard/modules/reporter/reporter_head.py:571— python/ray/dashboard/modules/reporter/reporter_head.py:571-597 | python/ray/dashboard/modules/reporter/reporter_head.py:640-681 | python/ray/dashboard/modules/reporter/reporter_head.py:743-777 — 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 (39–42 lines × 2) python/ray/rllib/core/learner/differentiable_learner.py:653— python/ray/rllib/core/learner/differentiable_learner.py:653-694 | python/ray/rllib/core/learner/learner.py:1699-1737 — before extracting anything, compare `python/ray/rllib/core/learner/differentiable_learner.py` and `python/ray/rllib/core/learner/learner.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 141 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 `python/ray/rllib/core/learner/differentiable_learner.py:653` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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 (42 lines × 2) python/ray/rllib/policy/torch_policy.py:188— python/ray/rllib/policy/torch_policy.py:188-229 | python/ray/rllib/policy/torch_policy_v2.py:114-155 — before extracting anything, compare `python/ray/rllib/policy/torch_policy.py` and `python/ray/rllib/policy/torch_policy_v2.py` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 513 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 (40–41 lines × 2) python/ray/llm/_internal/batch/processor/sglang_engine_proc.py:133— python/ray/llm/_internal/batch/processor/sglang_engine_proc.py:133-172 | python/ray/llm/_internal/batch/processor/vllm_engine_proc.py:203-243 — before extracting anything, compare `python/ray/llm/_internal/batch/processor/sglang_engine_proc.py` and `python/ray/llm/_internal/batch/processor/vllm_engine_proc.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 96 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 `python/ray/llm/_internal/batch/processor/sglang_engine_proc.py:133` 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 (38–41 lines × 2) python/ray/train/lightgbm/lightgbm_checkpoint.py:36— python/ray/train/lightgbm/lightgbm_checkpoint.py:36-73 | python/ray/train/xgboost/xgboost_checkpoint.py:36-76 — 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 (39 lines × 2) python/ray/rllib/policy/torch_policy.py:1155— python/ray/rllib/policy/torch_policy.py:1155-1193 | python/ray/rllib/policy/torch_policy_v2.py:1240-1278 — before extracting anything, compare `python/ray/rllib/policy/torch_policy.py` and `python/ray/rllib/policy/torch_policy_v2.py` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 513 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 `python/ray/rllib/policy/torch_policy.py:1155` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (37–39 lines × 2) python/ray/tune/cli/commands.py:161— python/ray/tune/cli/commands.py:161-199 | python/ray/tune/cli/commands.py:251-287 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22–38 lines × 2) python/ray/_private/services.py:1883— python/ray/_private/services.py:1883-1904 | python/ray/_private/services.py:1918-1955 — both copies are in the same file, so extract the 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 `python/ray/_private/services.py:1883` it begins part-way through the construct above it, so those 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 (37–38 lines × 2) python/ray/rllib/policy/dynamic_tf_policy.py:614— python/ray/rllib/policy/dynamic_tf_policy.py:614-650 | python/ray/rllib/policy/dynamic_tf_policy_v2.py:1000-1037 — before extracting anything, compare `python/ray/rllib/policy/dynamic_tf_policy.py` and `python/ray/rllib/policy/dynamic_tf_policy_v2.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 422 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 (33–37 lines × 3) python/ray/rllib/algorithms/cql/torch/cql_torch_learner.py:209— python/ray/rllib/algorithms/cql/torch/cql_torch_learner.py:209-245 | python/ray/rllib/algorithms/sac/torch/sac_torch_learner.py:236-268 | python/ray/rllib/algorithms/sac/torch/sac_torch_learner.py:368-400 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. The `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 (36–37 lines × 2) REDACTED:723— REDACTED:723-758 | REDACTED:1124-1160 — both copies are in the same file, so extract the 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:723` it begins part-way through the construct above it, so those 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 (37 lines × 2) python/ray/llm/_internal/batch/processor/sglang_engine_proc.py:179— python/ray/llm/_internal/batch/processor/sglang_engine_proc.py:179-215 | python/ray/llm/_internal/batch/processor/vllm_engine_proc.py:256-292 — before extracting anything, compare `python/ray/llm/_internal/batch/processor/sglang_engine_proc.py` and `python/ray/llm/_internal/batch/processor/vllm_engine_proc.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 96 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 `python/ray/llm/_internal/batch/processor/sglang_engine_proc.py:179` it begins part-way through the construct above it, so those 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) python/ray/tune/search/ax/ax_search.py:410— python/ray/tune/search/ax/ax_search.py:410-444 | REDACTED:416-447 — 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 (31–33 lines × 2) python/ray/rllib/algorithms/iql/torch/iql_torch_learner.py:53— python/ray/rllib/algorithms/iql/torch/iql_torch_learner.py:53-83 | python/ray/rllib/algorithms/sac/torch/sac_torch_learner.py:59-91 — before extracting anything, compare `python/ray/rllib/algorithms/iql/torch/iql_torch_learner.py` and `python/ray/rllib/algorithms/sac/torch/sac_torch_learner.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 90 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 `python/ray/rllib/algorithms/iql/torch/iql_torch_learner.py:53` 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–33 lines × 2) python/ray/rllib/utils/metrics/legacy_stats.py:925— python/ray/rllib/utils/metrics/legacy_stats.py:925-957 | python/ray/rllib/utils/metrics/stats/percentiles.py:270-301 — 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 (30–33 lines × 2) python/ray/tune/experimental/output.py:264— python/ray/tune/experimental/output.py:264-293 | python/ray/tune/progress_reporter.py:900-932 — 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 after the matched lines, `python/ray/tune/progress_reporter.py:934` calls `isinstance` and `python/ray/tune/experimental/output.py:295` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (17–32 lines × 2) python/ray/rllib/models/torch/modules/multi_head_attention.py:21— python/ray/rllib/models/torch/modules/multi_head_attention.py:21-37 | python/ray/rllib/models/torch/modules/relative_multi_head_attention.py:60-91 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `python/ray/rllib/models/torch/modules/multi_head_attention.py:21` 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 (19–32 lines × 2) python/ray/rllib/utils/replay_buffers/replay_buffer.py:45— python/ray/rllib/utils/replay_buffers/replay_buffer.py:45-63 | python/ray/rllib/utils/replay_buffers/utils.py:373-404 — 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 (22–32 lines × 2) python/ray/serve/_private/rolling_window.py:182— python/ray/serve/_private/rolling_window.py:182-213 | python/ray/serve/_private/rolling_window.py:263-284 — both copies are in the same file, so extract the 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 (26–31 lines × 3) python/ray/rllib/core/learner/differentiable_learner.py:378— python/ray/rllib/core/learner/differentiable_learner.py:378-408 | python/ray/rllib/core/learner/learner.py:1221-1246 | python/ray/rllib/core/learner/torch/torch_meta_learner.py:222-252 — before extracting anything, compare `python/ray/rllib/core/learner/differentiable_learner.py` and `python/ray/rllib/core/learner/learner.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 141 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 `python/ray/rllib/core/learner/differentiable_learner.py: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.
Duplicated block (31 lines × 2) python/ray/llm/_internal/batch/stages/tokenize_stage.py:24— python/ray/llm/_internal/batch/stages/tokenize_stage.py:24-54 | python/ray/llm/_internal/batch/stages/tokenize_stage.py:96-126 — both copies are in the same file, so extract the 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–30 lines × 3) REDACTED:56— REDACTED:56-69 | python/ray/_private/path_utils.py:11-32 | python/ray/_private/runtime_env/uv_runtime_env_hook.py:16-45 — 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 (27–29 lines × 2) python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_reduce_operator.py:286— python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_reduce_operator.py:286-312 | python/ray/data/_internal/execution/operators/shuffle_operators/shuffle_reduce_operator.py:331-359 — before extracting anything, compare `python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_reduce_operator.py` and `python/ray/data/_internal/execution/operators/shuffle_operators/shuffle_reduce_operator.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 144 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 (28 lines × 3) python/ray/rllib/algorithms/sac/torch/sac_torch_learner.py:229— python/ray/rllib/algorithms/sac/torch/sac_torch_learner.py:229-256 | python/ray/rllib/algorithms/sac/torch/sac_torch_learner.py:361-388 | python/ray/rllib/algorithms/tqc/torch/tqc_torch_learner.py:255-282 — 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 (27–28 lines × 2) python/ray/air/util/data_batch_conversion.py:98— python/ray/air/util/data_batch_conversion.py:98-125 | python/ray/data/util/data_batch_conversion.py:109-135 — before extracting anything, compare `python/ray/air/util/data_batch_conversion.py` and `python/ray/data/util/data_batch_conversion.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 113 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (21–28 lines × 2) REDACTED:1939— REDACTED:1939-1959 | REDACTED:1982-2009 — both copies are in the same file, so extract the 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:1982` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (26–28 lines × 2) REDACTED:226— REDACTED:226-253 | REDACTED:264-289 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:260` calls `__new__`, `super` and `REDACTED:225` 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–27 lines × 2) python/ray/rllib/algorithms/sac/torch/sac_torch_learner.py:179— python/ray/rllib/algorithms/sac/torch/sac_torch_learner.py:179-205 | python/ray/rllib/algorithms/sac/torch/sac_torch_learner.py:304-328 — both copies are in the same file, so extract the 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 `python/ray/rllib/algorithms/sac/torch/sac_torch_learner.py:179` it begins part-way through the construct above it, so those 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–27 lines × 2) python/ray/rllib/utils/exploration/per_worker_gaussian_noise.py:28— python/ray/rllib/utils/exploration/per_worker_gaussian_noise.py:28-50 | python/ray/rllib/utils/exploration/per_worker_ornstein_uhlenbeck_noise.py:28-54 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `python/ray/rllib/utils/exploration/per_worker_gaussian_noise.py:28` 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 (26–27 lines × 2) python/ray/tune/schedulers/hb_bohb.py:32— python/ray/tune/schedulers/hb_bohb.py:32-58 | python/ray/tune/schedulers/hyperband.py:160-185 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (20–26 lines × 2) python/ray/actor.py:2085— python/ray/actor.py:2085-2110 | python/ray/remote_function.py:485-504 — 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 `python/ray/actor.py:2085` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (25–26 lines × 2) python/ray/dashboard/modules/reporter/reporter_head.py:419— python/ray/dashboard/modules/reporter/reporter_head.py:419-444 | python/ray/dashboard/modules/reporter/reporter_head.py:542-566 — both copies are in the same file, so extract the 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 `python/ray/dashboard/modules/reporter/reporter_head.py:419` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (18–26 lines × 2) python/ray/data/_internal/datasource/parquet_datasource.py:1119— python/ray/data/_internal/datasource/parquet_datasource.py:1119-1136 | python/ray/data/_internal/datasource_v2/formats/parquet/parquet_file_reader.py:542-567 — 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 (24–26 lines × 2) python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_reduce_operator.py:105— python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_reduce_operator.py:105-128 | python/ray/data/_internal/execution/operators/shuffle_operators/shuffle_reduce_operator.py:136-161 — before extracting anything, compare `python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_reduce_operator.py` and `python/ray/data/_internal/execution/operators/shuffle_operators/shuffle_reduce_operator.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 144 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 (20–25 lines × 4) REDACTED:549— REDACTED:549-568 | REDACTED:593-615 | REDACTED:623-647 | REDACTED:653-677 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `body` to `EmbeddingRequest` in one and `ScoreRequest` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (19–24 lines × 2) python/ray/air/_internal/device_manager/npu.py:59— python/ray/air/_internal/device_manager/npu.py:59-77 | python/ray/air/_internal/device_manager/nvidia_gpu.py:35-58 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (21–24 lines × 2) python/ray/dashboard/modules/platform_events/providers/k8s_provider.py:387— python/ray/dashboard/modules/platform_events/providers/k8s_provider.py:387-407 | python/ray/dashboard/modules/platform_events/providers/k8s_provider.py:463-486 — both copies are in the same file, so extract the 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 `python/ray/dashboard/modules/platform_events/providers/k8s_provider.py:387` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (21–23 lines × 3) python/ray/rllib/algorithms/iql/torch/iql_torch_learner.py:73— python/ray/rllib/algorithms/iql/torch/iql_torch_learner.py:73-93 | python/ray/rllib/algorithms/sac/torch/sac_torch_learner.py:80-102 | python/ray/rllib/algorithms/tqc/torch/tqc_torch_learner.py:113-133 — before extracting anything, compare `python/ray/rllib/algorithms/iql/torch/iql_torch_learner.py` and `python/ray/rllib/algorithms/sac/torch/sac_torch_learner.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 90 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (21–22 lines × 2) python/ray/rllib/utils/exploration/gaussian_noise.py:206— python/ray/rllib/utils/exploration/gaussian_noise.py:206-226 | python/ray/rllib/utils/exploration/ornstein_uhlenbeck_noise.py:216-237 — before extracting anything, compare `python/ray/rllib/utils/exploration/gaussian_noise.py` and `python/ray/rllib/utils/exploration/ornstein_uhlenbeck_noise.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 58 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (20–21 lines × 4) python/ray/data/read_api.py:4700— python/ray/data/read_api.py:4700-4719 | python/ray/data/read_api.py:4809-4829 | python/ray/data/read_api.py:6023-6043 | python/ray/data/read_api.py:6139-6159 — 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 `python/ray/data/read_api.py:4700` it begins part-way through the construct above it, so those 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 (20–21 lines × 3) python/ray/data/read_api.py:3354— python/ray/data/read_api.py:3354-3374 | python/ray/data/read_api.py:3939-3958 | python/ray/data/read_api.py:4080-4100 — 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 `python/ray/data/read_api.py:3354` it begins part-way through the construct above it, so those 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–21 lines × 2) python/ray/rllib/algorithms/appo/appo_torch_policy.py:72— python/ray/rllib/algorithms/appo/appo_torch_policy.py:72-88 | python/ray/rllib/algorithms/impala/impala_torch_policy.py:254-274 — 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 `python/ray/rllib/algorithms/impala/impala_torch_policy.py:254` it begins part-way through the construct above it, so those 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) python/ray/rllib/models/tf/complex_input_net.py:174— python/ray/rllib/models/tf/complex_input_net.py:174-194 | python/ray/rllib/models/torch/complex_input_net.py:200-219 — `python/ray/rllib/models/tf/complex_input_net.py` and `python/ray/rllib/models/torch/complex_input_net.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 4 separate duplicated blocks between them, totalling at least 72 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 (19–20 lines × 4) python/ray/rllib/utils/replay_buffers/episode_replay_buffer.py:1054— python/ray/rllib/utils/replay_buffers/episode_replay_buffer.py:1054-1072 | python/ray/rllib/utils/replay_buffers/multi_agent_episode_buffer.py:836-855 | python/ray/rllib/utils/replay_buffers/multi_agent_prioritized_episode_buffer.py:1073-1092 | python/ray/rllib/utils/replay_buffers/prioritized_episode_buffer.py:603-621 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (20 lines × 3) REDACTED:110— REDACTED:110-129 | python/ray/tune/schedulers/hyperband.py:138-157 | python/ray/tune/schedulers/pbt.py:456-475 — 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 (19 lines × 13) python/ray/data/read_api.py:1023— python/ray/data/read_api.py:1023-1041 | python/ray/data/read_api.py:1170-1188 | python/ray/data/read_api.py:1401-1419 | python/ray/data/read_api.py:2067-2085 | python/ray/data/read_api.py:2249-2267 | python/ray/data/read_api.py:2639-2657 | python/ray/data/read_api.py:2782-2800 | python/ray/data/read_api.py:2915-2933 | python/ray/data/read_api.py:3111-3129 | python/ray/data/read_api.py:3359-3377 | python/ray/data/read_api.py:3539-3557 | python/ray/data/read_api.py:3943-3961 | python/ray/data/read_api.py:4085-4103 — all 13 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `python/ray/data/read_api.py:1023` it begins part-way through the construct above it, so those 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, `python/ray/data/read_api.py:2247` calls `ImageFileMetadataProvider` and `python/ray/data/read_api.py:1021` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (17–18 lines × 14) python/ray/data/read_api.py:1026— python/ray/data/read_api.py:1026-1042 | python/ray/data/read_api.py:1173-1189 | python/ray/data/read_api.py:1404-1420 | python/ray/data/read_api.py:2070-2086 | python/ray/data/read_api.py:2252-2268 | python/ray/data/read_api.py:2642-2658 | python/ray/data/read_api.py:2785-2801 | python/ray/data/read_api.py:2918-2934 | python/ray/data/read_api.py:3114-3130 | python/ray/data/read_api.py:3362-3378 | python/ray/data/read_api.py:3542-3558 | python/ray/data/read_api.py:3946-3962 | python/ray/data/read_api.py:4088-4104 | python/ray/data/read_api.py:6490-6507 — all 14 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `python/ray/data/read_api.py:1026` it begins part-way through the construct above it, so those 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–18 lines × 2) python/ray/_private/runtime_env/validation.py:254— python/ray/_private/runtime_env/validation.py:254-266 | python/ray/_private/runtime_env/validation.py:362-379 — both copies are in the same file, so extract the 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 `python/ray/_private/runtime_env/validation.py:254` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (7–18 lines × 2) python/ray/data/preprocessors/scaler.py:124— python/ray/data/preprocessors/scaler.py:124-130 | python/ray/data/preprocessors/scaler.py:305-322 — both copies are in the same file, so extract the 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–18 lines × 2) python/ray/rllib/utils/replay_buffers/multi_agent_prioritized_episode_buffer.py:322— python/ray/rllib/utils/replay_buffers/multi_agent_prioritized_episode_buffer.py:322-339 | python/ray/rllib/utils/replay_buffers/prioritized_episode_buffer.py:273-284 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (17 lines × 13) python/ray/data/read_api.py:1539— python/ray/data/read_api.py:1539-1555 | python/ray/data/read_api.py:2072-2088 | python/ray/data/read_api.py:2254-2270 | python/ray/data/read_api.py:2450-2467 | python/ray/data/read_api.py:2644-2660 | python/ray/data/read_api.py:2787-2803 | python/ray/data/read_api.py:2920-2936 | python/ray/data/read_api.py:3116-3132 | python/ray/data/read_api.py:3364-3380 | python/ray/data/read_api.py:3544-3560 | python/ray/data/read_api.py:3948-3964 | python/ray/data/read_api.py:4090-4106 | python/ray/data/read_api.py:6492-6509 — all 13 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `python/ray/data/read_api.py:1539` it begins part-way through the construct above it, so those 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 lines × 3) REDACTED:636— REDACTED:636-652 | REDACTED:800-816 | REDACTED:965-981 — 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) python/ray/data/read_api.py:2633— python/ray/data/read_api.py:2633-2649 | python/ray/data/read_api.py:2777-2792 | python/ray/data/read_api.py:3221-3236 — 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 `python/ray/data/read_api.py:2633` it begins part-way through the construct above it, so those 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–17 lines × 2) python/ray/rllib/utils/replay_buffers/episode_replay_buffer.py:233— python/ray/rllib/utils/replay_buffers/episode_replay_buffer.py:233-241 | python/ray/rllib/utils/replay_buffers/prioritized_episode_buffer.py:315-331 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `python/ray/rllib/utils/replay_buffers/prioritized_episode_buffer.py:315` it begins part-way through the construct above it, so those 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 × 4) python/ray/dashboard/modules/job/job_agent.py:78— python/ray/dashboard/modules/job/job_agent.py:78-92 | python/ray/dashboard/modules/job/job_agent.py:111-125 | python/ray/dashboard/modules/job/job_agent.py:144-159 | python/ray/dashboard/modules/job/job_agent.py:172-187 — 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 `python/ray/dashboard/modules/job/job_agent.py:78` 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 (14–16 lines × 4) python/ray/dashboard/modules/reporter/reporter_head.py:589— python/ray/dashboard/modules/reporter/reporter_head.py:589-603 | python/ray/dashboard/modules/reporter/reporter_head.py:673-687 | python/ray/dashboard/modules/reporter/reporter_head.py:769-782 | python/ray/dashboard/modules/reporter/reporter_head.py:852-867 — 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 `python/ray/dashboard/modules/reporter/reporter_head.py:589` 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, `python/ray/dashboard/modules/reporter/reporter_head.py:782` calls `HTTPInternalServerError` and `python/ray/dashboard/modules/reporter/reporter_head.py:603` 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 (15–16 lines × 3) python/ray/dashboard/modules/job/job_head.py:449— python/ray/dashboard/modules/job/job_head.py:449-463 | python/ray/dashboard/modules/job/job_head.py:481-495 | python/ray/dashboard/modules/job/job_head.py:570-585 — 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 `python/ray/dashboard/modules/job/job_head.py:449` 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 (16 lines × 3) REDACTED:904— REDACTED:904-919 | python/ray/experimental/sandbox/__init__.py:116-131 | python/ray/experimental/sandbox/sandbox.py:90-105 — 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 `REDACTED:904` it begins part-way through the construct above it, so those 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 × 8) python/ray/dashboard/dashboard.py:90— python/ray/dashboard/dashboard.py:90-104 | python/ray/rllib/utils/replay_buffers/episode_replay_buffer.py:1056-1070 | python/ray/rllib/utils/replay_buffers/multi_agent_episode_buffer.py:838-852 | python/ray/rllib/utils/replay_buffers/multi_agent_prioritized_episode_buffer.py:1075-1089 | python/ray/rllib/utils/replay_buffers/prioritized_episode_buffer.py:605-619 | python/ray/serve/api.py:745-759 | python/ray/tune/tune.py:767-781 | REDACTED:1197-1211 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 8 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 8 times. Read the line range as the matched WINDOW rather than a finished unit: at `python/ray/dashboard/dashboard.py:90` it begins part-way through the construct above it, so those 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 × 5) python/ray/dashboard/modules/job/job_agent.py:82— python/ray/dashboard/modules/job/job_agent.py:82-95 | python/ray/dashboard/modules/job/job_agent.py:115-128 | python/ray/dashboard/modules/job/job_head.py:453-466 | python/ray/dashboard/modules/job/job_head.py:485-498 | python/ray/dashboard/modules/job/job_head.py:574-588 — there are 5 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `python/ray/dashboard/modules/job/job_agent.py:82` it begins part-way through the construct above it, so those 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 × 3) python/ray/llm/_internal/serve/engines/vllm/vllm_engine.py:707— python/ray/llm/_internal/serve/engines/vllm/vllm_engine.py:707-719 | python/ray/llm/_internal/serve/engines/vllm/vllm_engine.py:742-756 | python/ray/llm/_internal/serve/engines/vllm/vllm_engine.py:809-823 — 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–15 lines × 2) python/ray/rllib/core/learner/torch/torch_learner.py:156— python/ray/rllib/core/learner/torch/torch_learner.py:156-167 | python/ray/rllib/core/learner/torch/torch_meta_learner.py:328-342 — 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 `python/ray/rllib/core/learner/torch/torch_meta_learner.py:328` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (13–14 lines × 3) python/ray/dashboard/modules/reporter/profile_manager.py:115— python/ray/dashboard/modules/reporter/profile_manager.py:115-127 | python/ray/dashboard/modules/reporter/profile_manager.py:193-205 | python/ray/dashboard/modules/reporter/profile_manager.py:362-375 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `python/ray/dashboard/modules/reporter/profile_manager.py:360` calls `str` and `python/ray/dashboard/modules/reporter/profile_manager.py:114` 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 × 3) python/ray/dashboard/modules/reporter/profile_manager.py:112— python/ray/dashboard/modules/reporter/profile_manager.py:112-123 | python/ray/dashboard/modules/reporter/profile_manager.py:190-201 | python/ray/dashboard/modules/reporter/profile_manager.py:309-322 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (14 lines × 3) python/ray/rllib/core/models/torch/encoder.py:52— python/ray/rllib/core/models/torch/encoder.py:52-65 | python/ray/rllib/core/models/torch/heads.py:22-35 | python/ray/rllib/core/models/torch/heads.py:81-94 — 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 `python/ray/rllib/core/models/torch/encoder.py:52` 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 `config` to `MLPEncoderConfig` in one and `MLPHeadConfig` 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 (11–14 lines × 2) python/ray/autoscaler/_private/aliyun/node_provider.py:50— python/ray/autoscaler/_private/aliyun/node_provider.py:50-60 | python/ray/autoscaler/_private/aws/node_provider.py:118-131 — 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 `python/ray/autoscaler/_private/aws/node_provider.py:118` it begins part-way through the construct above it, so those 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, `python/ray/autoscaler/_private/aliyun/node_provider.py:47` calls `randint` and `python/ray/autoscaler/_private/aws/node_provider.py:118` 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 (10–14 lines × 2) python/ray/rllib/algorithms/appo/appo_torch_policy.py:191— python/ray/rllib/algorithms/appo/appo_torch_policy.py:191-204 | python/ray/rllib/algorithms/impala/impala_torch_policy.py:321-330 — 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–13 lines × 6) doc/source/serve/doc_code/develop_and_deploy.py:24— doc/source/serve/doc_code/develop_and_deploy.py:24-36 | doc/source/serve/doc_code/getting_started/model_deployment.py:24-36 | doc/source/serve/doc_code/getting_started/model_deployment_full.py:22-34 | doc/source/serve/doc_code/getting_started/models.py:16-28 | doc/source/serve/doc_code/getting_started/translator.py:23-35 | doc/source/serve/doc_code/getting_started/translator.py:49-59 — there are 6 copies across 5 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 6 sites; resolving a subset leaves the remainder to drift apart. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `doc/source/serve/doc_code/develop_and_deploy.py:21` calls `post` and `doc/source/serve/doc_code/getting_started/models.py:12` 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–13 lines × 2) python/ray/rllib/algorithms/cql/cql.py:346— python/ray/rllib/algorithms/cql/cql.py:346-355 | python/ray/rllib/algorithms/dqn/dqn.py:825-837 — 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 `python/ray/rllib/algorithms/dqn/dqn.py:825` it begins part-way through the construct above it, so those 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 × 7) python/ray/dashboard/modules/job/job_agent.py:82— python/ray/dashboard/modules/job/job_agent.py:82-93 | python/ray/dashboard/modules/job/job_agent.py:115-126 | python/ray/dashboard/modules/job/job_agent.py:148-160 | python/ray/dashboard/modules/job/job_agent.py:176-188 | python/ray/dashboard/modules/job/job_head.py:453-464 | python/ray/dashboard/modules/job/job_head.py:485-496 | python/ray/dashboard/modules/job/job_head.py:574-586 — there are 7 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 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 `python/ray/dashboard/modules/job/job_agent.py:82` it begins part-way through the construct above it, so those 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 × 4) python/ray/rllib/models/tf/attention_net.py:418— python/ray/rllib/models/tf/attention_net.py:418-429 | python/ray/rllib/models/tf/recurrent_net.py:159-170 | python/ray/rllib/models/torch/attention_net.py:289-300 | python/ray/rllib/models/torch/recurrent_net.py:156-167 — `python/ray/rllib/models/tf/attention_net.py` and `python/ray/rllib/models/torch/attention_net.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 5 separate duplicated blocks between them, totalling at least 114 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `python/ray/rllib/models/torch/recurrent_net.py:152` calls `get` and `python/ray/rllib/models/tf/recurrent_net.py: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 (11–12 lines × 3) python/ray/tune/search/bohb/bohb_search.py:215— python/ray/tune/search/bohb/bohb_search.py:215-226 | REDACTED:496-506 | REDACTED:583-593 — 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 `python/ray/tune/search/bohb/bohb_search.py:215` 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–12 lines × 2) doc/source/tune/doc_code/pytorch_optuna.py:46— doc/source/tune/doc_code/pytorch_optuna.py:46-53 | python/ray/tune/examples/mnist_pytorch.py:71-82 — before extracting anything, compare `doc/source/tune/doc_code/pytorch_optuna.py` and `python/ray/tune/examples/mnist_pytorch.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 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 `doc/source/tune/doc_code/pytorch_optuna.py:46` 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–12 lines × 2) python/ray/rllib/models/tf/visionnet.py:42— python/ray/rllib/models/tf/visionnet.py:42-53 | python/ray/rllib/models/torch/visionnet.py:42-52 — 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 `python/ray/rllib/models/tf/visionnet.py:42` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 8) python/ray/tune/search/ax/ax_search.py:325— python/ray/tune/search/ax/ax_search.py:325-336 | REDACTED:285-296 | python/ray/tune/search/bohb/bohb_search.py:216-227 | REDACTED:269-280 | REDACTED:266-276 | REDACTED:497-507 | REDACTED:584-594 | REDACTED:272-282 — there are 8 copies across 7 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 8 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (8–10 lines × 7) REDACTED:400— REDACTED:400-407 | REDACTED:438-447 | REDACTED:562-569 | REDACTED:600-609 | REDACTED:726-733 | REDACTED:764-773 | REDACTED:890-897 — all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9–10 lines × 3) python/ray/data/_internal/execution/operators/hash_aggregate.py:159— python/ray/data/_internal/execution/operators/hash_aggregate.py:159-168 | REDACTED:1665-1673 | python/ray/data/_internal/execution/operators/join.py:744-753 — 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 `python/ray/data/_internal/execution/operators/hash_aggregate.py:159` it begins part-way through the construct above it, so those 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) REDACTED:162— REDACTED:162-168 | REDACTED:285-293 — both copies are in the same file, so extract the 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:162` 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–8 lines × 2) python/ray/_private/ray_microbenchmark_helpers.py:40— python/ray/_private/ray_microbenchmark_helpers.py:40-47 | python/ray/_private/ray_microbenchmark_helpers.py:76-82 — both copies are in the same file, so extract the 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 × 7) REDACTED:392— REDACTED:392-398 | REDACTED:430-436 | REDACTED:554-560 | REDACTED:592-598 | REDACTED:718-724 | REDACTED:756-762 | REDACTED:882-888 — all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 6) REDACTED:381— REDACTED:381-387 | REDACTED:419-425 | REDACTED:543-549 | REDACTED:581-587 | REDACTED:707-713 | REDACTED:745-751 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 4) REDACTED:383— REDACTED:383-389 | REDACTED:545-551 | REDACTED:709-715 | REDACTED:873-879 — 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 (5 lines × 5) REDACTED:304— REDACTED:304-308 | REDACTED:385-389 | REDACTED:547-551 | REDACTED:711-715 | REDACTED:875-879 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 3) python/ray/rllib/utils/replay_buffers/multi_agent_mixin_replay_buffer.py:247— python/ray/rllib/utils/replay_buffers/multi_agent_mixin_replay_buffer.py:247-252 | python/ray/rllib/utils/replay_buffers/multi_agent_prioritized_replay_buffer.py:184-188 | python/ray/rllib/utils/replay_buffers/multi_agent_replay_buffer.py:269-273 — before extracting anything, compare `python/ray/rllib/utils/replay_buffers/multi_agent_prioritized_replay_buffer.py` and `python/ray/rllib/utils/replay_buffers/multi_agent_replay_buffer.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 80 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 (54 lines × 2) python/ray/llm/_internal/common/utils/cloud_filesystem/azure_filesystem.py:28— python/ray/llm/_internal/common/utils/cloud_filesystem/azure_filesystem.py:28-82 | python/ray/llm/_internal/common/utils/cloud_filesystem/gcs_filesystem.py:28-81 — 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 `python/ray/llm/_internal/common/utils/cloud_filesystem/azure_filesystem.py:28` 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) python/ray/_private/accelerators/amd_gpu.py:118— python/ray/_private/accelerators/amd_gpu.py:118-123 | python/ray/_private/accelerators/hpu.py:117-122 | python/ray/_private/accelerators/npu.py:95-100 | python/ray/_private/accelerators/nvidia_gpu.py:112-117 | python/ray/_private/accelerators/ttnpu.py:66-71 — 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.
Duplicated block (91–93 lines × 2) java/runtime/src/main/java/io/ray/runtime/util/generator/ParallelActorCallGenerator.java:106— java/runtime/src/main/java/io/ray/runtime/util/generator/ParallelActorCallGenerator.java:106-198 | java/runtime/src/main/java/io/ray/runtime/util/generator/RayCallGenerator.java:174-264 — before extracting anything, compare `java/runtime/src/main/java/io/ray/runtime/util/generator/ParallelActorCallGenerator.java` and `java/runtime/src/main/java/io/ray/runtime/util/generator/RayCallGenerator.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 192 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 `java/runtime/src/main/java/io/ray/runtime/util/generator/ParallelActorCallGenerator.java:106` 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 (55–59 lines × 3) java/runtime/src/main/java/io/ray/runtime/util/generator/ParallelActorCallGenerator.java:223— java/runtime/src/main/java/io/ray/runtime/util/generator/ParallelActorCallGenerator.java:223-281 | java/runtime/src/main/java/io/ray/runtime/util/generator/RayCallGenerator.java:285-339 | java/runtime/src/main/java/io/ray/runtime/util/generator/RayCallGenerator.java:342-400 — before extracting anything, compare `java/runtime/src/main/java/io/ray/runtime/util/generator/ParallelActorCallGenerator.java` and `java/runtime/src/main/java/io/ray/runtime/util/generator/RayCallGenerator.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 192 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. 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 (16–17 lines × 4) java/runtime/src/main/java/io/ray/runtime/util/generator/ConcurrencyGroupBuilderGenerator.java:73— java/runtime/src/main/java/io/ray/runtime/util/generator/ConcurrencyGroupBuilderGenerator.java:73-88 | java/runtime/src/main/java/io/ray/runtime/util/generator/ParallelActorCallGenerator.java:52-68 | java/runtime/src/main/java/io/ray/runtime/util/generator/RayCallGenerator.java:30-46 | java/runtime/src/main/java/io/ray/runtime/util/generator/RayCallGenerator.java:86-101 — before extracting anything, compare `java/runtime/src/main/java/io/ray/runtime/util/generator/ParallelActorCallGenerator.java` and `java/runtime/src/main/java/io/ray/runtime/util/generator/RayCallGenerator.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 192 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, `java/runtime/src/main/java/io/ray/runtime/util/generator/ParallelActorCallGenerator.java:50` calls `newLine` and `java/runtime/src/main/java/io/ray/runtime/util/generator/ConcurrencyGroupBuilderGenerator.java:72` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Near-duplicate member pair (124 shared lines) release/air_tests/air_benchmarks/workloads/tensorflow_benchmark.py:254— release/air_tests/air_benchmarks/workloads/tensorflow_benchmark.py:254-400 | release/air_tests/air_benchmarks/workloads/torch_benchmark.py:416-549 — These two members are variants of one another: 124 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 (86 shared lines) release/nightly_tests/dataset/gpu_batch_inference.py:49— release/nightly_tests/dataset/gpu_batch_inference.py:49-172 | release/nightly_tests/dataset/image_classification_from_parquet/main.py:52-154 — These two members are variants of one another: 86 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.
Duplicated block (100 lines × 2) release/nightly_tests/dataset/benchmark.py:380— release/nightly_tests/dataset/benchmark.py:380-479 | release/nightly_tests/multimodal_inference_benchmarks/benchmark.py:380-479 — `release/nightly_tests/dataset/benchmark.py` and `release/nightly_tests/multimodal_inference_benchmarks/benchmark.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 9 separate duplicated blocks between them, totalling at least 302 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 (81–82 lines × 2) release/air_tests/air_benchmarks/workloads/tensorflow_benchmark.py:319— release/air_tests/air_benchmarks/workloads/tensorflow_benchmark.py:319-400 | release/air_tests/air_benchmarks/workloads/torch_benchmark.py:469-549 — before extracting anything, compare `release/air_tests/air_benchmarks/workloads/tensorflow_benchmark.py` and `release/air_tests/air_benchmarks/workloads/torch_benchmark.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 155 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 (46 lines × 2) release/nightly_tests/dataset/gpu_batch_inference.py:74— release/nightly_tests/dataset/gpu_batch_inference.py:74-119 | release/nightly_tests/dataset/image_classification_from_parquet/main.py:77-122 — before extracting anything, compare `release/nightly_tests/dataset/gpu_batch_inference.py` and `release/nightly_tests/dataset/image_classification_from_parquet/main.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 115 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 (39–42 lines × 3) python/ray/train/examples/horovod/horovod_example.py:65— python/ray/train/examples/horovod/horovod_example.py:65-103 | python/ray/train/examples/horovod/horovod_pytorch_example.py:66-107 | release/ml_user_tests/horovod/horovod_example.py:65-103 — before extracting anything, compare `python/ray/train/examples/horovod/horovod_example.py` and `python/ray/train/examples/horovod/horovod_pytorch_example.py` as WHOLE FILES: this scan already matched 5 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.
Duplicated block (39–41 lines × 2) python/ray/train/examples/accelerate/accelerate_torch_trainer.py:92— python/ray/train/examples/accelerate/accelerate_torch_trainer.py:92-130 | python/ray/train/examples/accelerate/accelerate_torch_trainer_no_raydata.py:105-145 — 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 `python/ray/train/examples/accelerate/accelerate_torch_trainer_no_raydata.py:105` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (28–39 lines × 2) release/nightly_tests/dataset/tpch/tpch_q2.py:144— release/nightly_tests/dataset/tpch/tpch_q2.py:144-171 | release/nightly_tests/dataset/tpch/tpch_q9.py:106-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 both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `release/nightly_tests/dataset/tpch/tpch_q2.py:144` it begins part-way through the construct above it, so those 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) release/nightly_tests/dataset/profiling/perf.py:387— release/nightly_tests/dataset/profiling/perf.py:387-420 | REDACTED:378-411 — 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 (23–24 lines × 2) python/ray/rllib/examples/envs/classes/multi_agent/pettingzoo_chess.py:134— python/ray/rllib/examples/envs/classes/multi_agent/pettingzoo_chess.py:134-156 | python/ray/rllib/examples/envs/classes/multi_agent/pettingzoo_connect4.py:125-148 — before extracting anything, compare `python/ray/rllib/examples/envs/classes/multi_agent/pettingzoo_chess.py` and `python/ray/rllib/examples/envs/classes/multi_agent/pettingzoo_connect4.py` as WHOLE FILES: 88% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (23 lines × 3) python/ray/train/examples/horovod/horovod_example.py:112— python/ray/train/examples/horovod/horovod_example.py:112-134 | python/ray/train/examples/horovod/horovod_pytorch_example.py:116-138 | release/ml_user_tests/horovod/horovod_example.py:106-128 — before extracting anything, compare `python/ray/train/examples/horovod/horovod_example.py` and `python/ray/train/examples/horovod/horovod_pytorch_example.py` as WHOLE FILES: this scan already matched 5 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.
Duplicated block (16–23 lines × 2) release/nightly_tests/dataset/profiling/metrics.py:222— release/nightly_tests/dataset/profiling/metrics.py:222-244 | release/nightly_tests/dataset/profiling/metrics.py:348-363 — both copies are in the same file, so extract the 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 `release/nightly_tests/dataset/profiling/metrics.py:222` 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 (18–22 lines × 2) python/ray/rllib/examples/multi_agent/utils/self_play_league_based_callback.py:105— python/ray/rllib/examples/multi_agent/utils/self_play_league_based_callback.py:105-126 | python/ray/rllib/examples/multi_agent/utils/self_play_league_based_callback_old_api_stack.py:66-83 — 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 `python/ray/rllib/examples/multi_agent/utils/self_play_league_based_callback.py:105` 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 (19–21 lines × 2) python/ray/rllib/examples/_old_api_stack/models/shared_weights_model.py:76— python/ray/rllib/examples/_old_api_stack/models/shared_weights_model.py:76-94 | python/ray/rllib/examples/_old_api_stack/models/shared_weights_model.py:113-133 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16–20 lines × 2) release/nightly_tests/dataset/gpu_batch_inference.py:153— release/nightly_tests/dataset/gpu_batch_inference.py:153-172 | release/nightly_tests/dataset/image_classification_from_parquet/main.py:139-154 — before extracting anything, compare `release/nightly_tests/dataset/gpu_batch_inference.py` and `release/nightly_tests/dataset/image_classification_from_parquet/main.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 115 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 `release/nightly_tests/dataset/gpu_batch_inference.py:153` it begins part-way through the construct above it, so those 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–18 lines × 2) python/ray/train/examples/accelerate/accelerate_torch_trainer.py:50— python/ray/train/examples/accelerate/accelerate_torch_trainer.py:50-63 | python/ray/train/examples/deepspeed/deepspeed_torch_trainer.py:36-53 — 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 `python/ray/train/examples/deepspeed/deepspeed_torch_trainer.py:36` it begins part-way through the construct above it, so those 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, `python/ray/train/examples/accelerate/accelerate_torch_trainer.py:64` calls `to`, `items` and `python/ray/train/examples/deepspeed/deepspeed_torch_trainer.py:54` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (16 lines × 4) python/ray/rllib/examples/algorithms/dqn/benchmark_dqn_atari.py:266— python/ray/rllib/examples/algorithms/dqn/benchmark_dqn_atari.py:266-281 | python/ray/rllib/examples/algorithms/dqn/benchmark_dqn_atari_rllib_preprocessing.py:256-271 | python/ray/rllib/examples/algorithms/ppo/benchmark_ppo_mujoco.py:61-76 | python/ray/rllib/examples/algorithms/sac/benchmark_sac_mujoco.py:52-67 — before extracting anything, compare `python/ray/rllib/examples/algorithms/dqn/benchmark_dqn_atari.py` and `python/ray/rllib/examples/algorithms/dqn/benchmark_dqn_atari_rllib_preprocessing.py` as WHOLE FILES: 89% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (11–13 lines × 2) release/air_tests/air_benchmarks/workloads/torch_benchmark.py:45— release/air_tests/air_benchmarks/workloads/torch_benchmark.py:45-57 | release/train_tests/elastic_training/torch_elastic_e2e.py:54-64 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (8–11 lines × 3) release/nightly_tests/dataset/tpch/tpch_q5.py:35— release/nightly_tests/dataset/tpch/tpch_q5.py:35-42 | release/nightly_tests/dataset/tpch/tpch_q8.py:46-53 | release/nightly_tests/dataset/tpch/tpch_q9.py:39-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 all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `release/nightly_tests/dataset/tpch/tpch_q5.py:35` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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, `release/nightly_tests/dataset/tpch/tpch_q8.py:56` calls `load_table`, `select_columns` and `release/nightly_tests/dataset/tpch/tpch_q5.py:43` 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–10 lines × 3) release/nightly_tests/dataset/tpch/tpch_q20.py:51— release/nightly_tests/dataset/tpch/tpch_q20.py:51-56 | release/nightly_tests/dataset/tpch/tpch_q8.py:50-59 | release/nightly_tests/dataset/tpch/tpch_q9.py:38-45 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `release/nightly_tests/dataset/tpch/tpch_q20.py:51` 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–9 lines × 3) release/nightly_tests/dataset/tpch/tpch_q10.py:44— release/nightly_tests/dataset/tpch/tpch_q10.py:44-50 | release/nightly_tests/dataset/tpch/tpch_q21.py:50-58 | release/nightly_tests/dataset/tpch/tpch_q5.py:42-50 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. 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–8 lines × 2) release/nightly_tests/dataset/profiling/analysis/analyze_pyspy_profile.py:231— release/nightly_tests/dataset/profiling/analysis/analyze_pyspy_profile.py:231-238 | release/nightly_tests/dataset/profiling/analysis/analyze_pyspy_profile.py:619-624 — both copies are in the same file, so extract the 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 (3–5 lines × 4) python/ray/train/examples/horovod/horovod_example.py:36— python/ray/train/examples/horovod/horovod_example.py:36-40 | python/ray/train/examples/horovod/horovod_pytorch_example.py:37-41 | python/ray/tune/examples/pbt_dcgan_mnist/common.py:138-140 | release/ml_user_tests/horovod/horovod_example.py:34-38 — before extracting anything, compare `python/ray/train/examples/horovod/horovod_example.py` and `python/ray/train/examples/horovod/horovod_pytorch_example.py` as WHOLE FILES: this scan already matched 5 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. 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `python/ray/train/examples/horovod/horovod_example.py:35` calls `relu`, `max_pool2d`, `conv2_drop` and `python/ray/tune/examples/pbt_dcgan_mnist/common.py:138` 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) python/ray/train/examples/horovod/horovod_example.py:26— python/ray/train/examples/horovod/horovod_example.py:26-31 | python/ray/train/examples/horovod/horovod_pytorch_example.py:27-32 | python/ray/tune/examples/pbt_dcgan_mnist/common.py:130-135 | release/ml_user_tests/horovod/horovod_example.py:24-29 — before extracting anything, compare `python/ray/train/examples/horovod/horovod_example.py` and `python/ray/train/examples/horovod/horovod_pytorch_example.py` as WHOLE FILES: this scan already matched 5 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.
Duplication concentrated across 4 sibling directories (9 clone groups) python/ray/dashboard/client/src/pages/actor/ActorDetail.tsx:63— 9 duplicated blocks under python/ray/dashboard/client/src/pages/ have copies in at least two of the sibling directories actor, job, node, serve — 6 of them are reported below, and 3 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 9 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 9 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 9 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
Duplication concentrated across 3 sibling directories (6 clone groups) python/ray/dashboard/client/src/components/TaskTable.tsx:197— 6 of the duplicated blocks reported below have copies in at least two of the sibling directories components, pages, util under python/ray/dashboard/client/src/. That concentration is one structural fact, not 6 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 6 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
R10 · Code Duplication· Duplicated block with local edits (168 matched lines × 2 locations) · ×1
Duplicated block with local edits (168 matched lines × 2 locations) python/ray/dashboard/client/src/pages/serve/ServeApplicationDetailPage.tsx:63— python/ray/dashboard/client/src/pages/serve/ServeApplicationDetailPage.tsx:63 · python/ray/dashboard/client/src/pages/serve/ServeDeploymentDetailPage.tsx:67 — the two spans are one implementation copied and then locally edited — 838 tokens are still identical, in the same order in both files, 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.
R10 · Code Duplication· Duplicated block with local edits (121 matched lines × 2 locations) · ×1
Duplicated block with local edits (121 matched lines × 2 locations) python/ray/dashboard/client/src/components/PlacementGroupTable.tsx:76— python/ray/dashboard/client/src/components/PlacementGroupTable.tsx:76 · python/ray/dashboard/client/src/components/TaskTable.tsx:57 — the two spans are one implementation copied and then locally edited — 820 tokens are still identical, in the same order in both files, 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.
R10 · Code Duplication· Duplicated block with local edits (56 matched lines × 2 locations) · ×1
Duplicated block with local edits (56 matched lines × 2 locations) python/ray/dashboard/client/src/pages/actor/ActorDetail.tsx:63— python/ray/dashboard/client/src/pages/actor/ActorDetail.tsx:63 · python/ray/dashboard/client/src/pages/job/JobDetailInfoPage.tsx:44 — the two spans are one implementation copied and then locally edited — 221 tokens are still identical, in the same order in both files, 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.
R10 · Code Duplication· Duplicated block with local edits (44 matched lines × 2 locations) · ×1
Duplicated block with local edits (44 matched lines × 2 locations) python/ray/dashboard/client/src/pages/node/AcceleratorColumn.tsx:102— python/ray/dashboard/client/src/pages/node/AcceleratorColumn.tsx:102 · python/ray/dashboard/client/src/pages/node/AcceleratorMemoryColumn.tsx:34 — the two spans are one implementation copied and then locally edited — 250 tokens are still identical, in the same order in both files, 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 (41 lines × 2 locations) python/ray/dashboard/client/src/pages/serve/ServeDeploymentMetricsSection.tsx:106— python/ray/dashboard/client/src/pages/serve/ServeDeploymentMetricsSection.tsx:106 · python/ray/dashboard/client/src/pages/serve/ServeMetricsSection.tsx:121 — the 2 copies are spread across 2 files, 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 (39 lines × 2 locations) python/ray/dashboard/client/src/pages/job/TaskProgressBar.tsx:34— python/ray/dashboard/client/src/pages/job/TaskProgressBar.tsx:34 · python/ray/dashboard/client/src/pages/job/TaskProgressBar.tsx:145 — all 2 copies are in the same file, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
Duplicated block (37 lines × 2 locations) python/ray/dashboard/client/src/pages/serve/ServeDeploymentMetricsSection.tsx:56— python/ray/dashboard/client/src/pages/serve/ServeDeploymentMetricsSection.tsx:56 · python/ray/dashboard/client/src/pages/serve/ServeMetricsSection.tsx:82 — the 2 copies are spread across 2 files, 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 (29 lines × 2 locations) python/ray/dashboard/client/src/pages/serve/hook/useServeApplications.ts:85— python/ray/dashboard/client/src/pages/serve/hook/useServeApplications.ts:85 · python/ray/dashboard/client/src/pages/serve/hook/useServeApplications.ts:148 — 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 (28 lines × 2 locations) python/ray/dashboard/client/src/components/ActorTable.tsx:801— python/ray/dashboard/client/src/components/ActorTable.tsx:801 · python/ray/dashboard/client/src/components/TaskTable.tsx:288 — the 2 copies are spread across 2 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
R10 · Code Duplication· Duplicated block with local edits (27 matched lines × 2 locations) · ×1
Duplicated block with local edits (27 matched lines × 2 locations) python/ray/dashboard/client/src/pages/node/AcceleratorMemoryColumn.tsx:15— python/ray/dashboard/client/src/pages/node/AcceleratorMemoryColumn.tsx:15 · python/ray/dashboard/client/src/pages/node/AcceleratorMemoryColumn.tsx:59 — the two spans are one implementation copied and then locally edited — 182 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 (22 lines × 3 locations) python/ray/dashboard/client/src/App.tsx:453— python/ray/dashboard/client/src/App.tsx:453 · python/ray/dashboard/client/src/App.tsx:479 · python/ray/dashboard/client/src/App.tsx:528 — 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 (19 lines × 2 locations) python/ray/dashboard/client/src/components/PlacementGroupTable.tsx:26— python/ray/dashboard/client/src/components/PlacementGroupTable.tsx:26 · python/ray/dashboard/client/src/components/PlacementGroupTable.tsx:45 — 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 (19 lines × 4 locations) python/ray/dashboard/client/src/components/TaskTable.tsx:197— python/ray/dashboard/client/src/components/TaskTable.tsx:197 · python/ray/dashboard/client/src/pages/job/JobTaskNameProgressTable/JobTaskNameProgressTable.tsx:43 · python/ray/dashboard/client/src/pages/job/index.tsx:150 · REDACTED:385 — the 4 copies are spread across 4 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
Duplicated block (16 lines × 4 locations) python/ray/dashboard/client/src/components/EventTable.tsx:142— python/ray/dashboard/client/src/components/EventTable.tsx:142 · python/ray/dashboard/client/src/components/EventTable.tsx:158 · python/ray/dashboard/client/src/components/EventTable.tsx:174 · python/ray/dashboard/client/src/components/EventTable.tsx:190 — all 4 copies are in the same file, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
Duplicated block (15 lines × 3 locations) python/ray/dashboard/client/src/common/JobStatus.tsx:65— python/ray/dashboard/client/src/common/JobStatus.tsx:65 · python/ray/dashboard/client/src/common/JobStatus.tsx:80 · python/ray/dashboard/client/src/common/JobStatus.tsx:95 — 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 (15 lines × 6 locations) python/ray/dashboard/client/src/components/ActorTable.tsx:431— python/ray/dashboard/client/src/components/ActorTable.tsx:431 · python/ray/dashboard/client/src/components/ActorTable.tsx:450 · python/ray/dashboard/client/src/components/ActorTable.tsx:467 · python/ray/dashboard/client/src/components/ActorTable.tsx:484 · +2 more site(s) not listed — the 6 copies are spread across 2 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
Boundary violation [package:third-party-deep-import] python/ray/dashboard/client/src/pages/layout/SideTabLayout.tsx:3— python/ray/dashboard/client/src/pages/layout/SideTabLayout.tsx:3 imports react-icons/lib, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
Complex function ServeEntityLogViewer (cyclomatic 28, cognitive 23) python/ray/dashboard/client/src/pages/serve/ServeEntityLogViewer.tsx:32— ServeEntityLogViewer has cyclomatic complexity 28 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 (anonymous) (cyclomatic 21, cognitive 20) python/ray/dashboard/client/src/components/ActorTable.tsx:613— (anonymous) has cyclomatic complexity 21 and cognitive complexity 20; 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 ActorDetailPage (cyclomatic 21, cognitive 20) python/ray/dashboard/client/src/pages/actor/ActorDetail.tsx:53— ActorDetailPage has cyclomatic complexity 21 and cognitive complexity 20; 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 NodeDetailPage (cyclomatic 20, cognitive 14) python/ray/dashboard/client/src/pages/node/NodeDetail.tsx:15— NodeDetailPage has cyclomatic complexity 20 and cognitive complexity 14; 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 AdvancedProgressBarSegment (cyclomatic 18, cognitive 17) python/ray/dashboard/client/src/pages/job/AdvancedProgressBar/AdvancedProgressBar.tsx:78— AdvancedProgressBarSegment has cyclomatic complexity 18 and cognitive complexity 17; 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 (anonymous) (cyclomatic 16, cognitive 15) python/ray/dashboard/client/src/components/TaskTable.tsx:218— (anonymous) has cyclomatic complexity 16 and cognitive complexity 15; 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 TaskPageContents (cyclomatic 16, cognitive 15) python/ray/dashboard/client/src/pages/task/TaskPage.tsx:67— TaskPageContents has cyclomatic complexity 16 and cognitive complexity 15; 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 DataRow (cyclomatic 16, cognitive 13) python/ray/dashboard/client/src/components/DataOverviewTable.tsx:162— DataRow has cyclomatic complexity 16 and cognitive complexity 13; 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 JobRow (cyclomatic 15, cognitive 14) python/ray/dashboard/client/src/pages/job/JobRow.tsx:21— JobRow has cyclomatic complexity 15 and cognitive complexity 14; 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 ServeReplicaDetailPage (cyclomatic 15, cognitive 13) python/ray/dashboard/client/src/pages/serve/ServeReplicaDetailPage.tsx:23— ServeReplicaDetailPage has cyclomatic complexity 15 and cognitive complexity 13; 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 ProgressBar (cyclomatic 14, cognitive 13) python/ray/dashboard/client/src/components/ProgressBar/ProgressBar.tsx:73— ProgressBar has cyclomatic complexity 14 and cognitive complexity 13; 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 JobStatusIcon (cyclomatic 13, cognitive 19) python/ray/dashboard/client/src/common/JobStatus.tsx:58— JobStatusIcon has cyclomatic complexity 13 and cognitive complexity 19; 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 ServeSystemActorDetail (cyclomatic 13, cognitive 11) python/ray/dashboard/client/src/pages/serve/ServeSystemActorDetailPage.tsx:120— ServeSystemActorDetail has cyclomatic complexity 13 and cognitive complexity 11; 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 NodeRow (cyclomatic 13, cognitive 10) python/ray/dashboard/client/src/pages/node/NodeRow.tsx:51— NodeRow has cyclomatic complexity 13 and cognitive complexity 10; 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 JobMetadataSection (cyclomatic 12, cognitive 11) python/ray/dashboard/client/src/pages/job/JobDetailInfoPage.tsx:79— JobMetadataSection has cyclomatic complexity 12 and cognitive complexity 11; 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 MetadataContentField (cyclomatic 11, cognitive 12) python/ray/dashboard/client/src/components/MetadataSection/MetadataSection.tsx:69— MetadataContentField has cyclomatic complexity 11 and cognitive complexity 12; 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 JobProgressBar (cyclomatic 11, cognitive 9) python/ray/dashboard/client/src/pages/job/JobProgressBar.tsx:16— JobProgressBar has cyclomatic complexity 11 and cognitive complexity 9; 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.
R3 · Large Files· python/ray/dashboard/client/src/components/ActorTable.tsx · ×1
python/ray/dashboard/client/src/components/ActorTable.tsx: 836 lines of code python/ray/dashboard/client/src/components/ActorTable.tsx:1— python/ray/dashboard/client/src/components/ActorTable.tsx has 836 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· python/ray/dashboard/client/src/common/timezone.ts · ×1
python/ray/dashboard/client/src/common/timezone.ts: 678 lines of code python/ray/dashboard/client/src/common/timezone.ts:1— python/ray/dashboard/client/src/common/timezone.ts has 678 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· python/ray/dashboard/client/src/common/ProfilingLink.tsx · ×1
python/ray/dashboard/client/src/common/ProfilingLink.tsx: 644 lines of code python/ray/dashboard/client/src/common/ProfilingLink.tsx:1— python/ray/dashboard/client/src/common/ProfilingLink.tsx has 644 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· python/ray/dashboard/client/src/App.tsx · ×1
python/ray/dashboard/client/src/App.tsx: 569 lines of code python/ray/dashboard/client/src/App.tsx:1— python/ray/dashboard/client/src/App.tsx has 569 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· python/ray/dashboard/client/src/pages/layout/MainNavLayout.tsx · ×1
python/ray/dashboard/client/src/pages/layout/MainNavLayout.tsx: 443 lines of code python/ray/dashboard/client/src/pages/layout/MainNavLayout.tsx:1— python/ray/dashboard/client/src/pages/layout/MainNavLayout.tsx has 443 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: 436 lines of code REDACTED:1— REDACTED has 436 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· python/ray/dashboard/client/src/components/LogView/LogVirtualView.tsx · ×1
python/ray/dashboard/client/src/components/LogView/LogVirtualView.tsx: 411 lines of code python/ray/dashboard/client/src/components/LogView/LogVirtualView.tsx:1— python/ray/dashboard/client/src/components/LogView/LogVirtualView.tsx has 411 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· python/ray/dashboard/client/src/pages/node/NodeRow.tsx · ×1
python/ray/dashboard/client/src/pages/node/NodeRow.tsx: 411 lines of code python/ray/dashboard/client/src/pages/node/NodeRow.tsx:1— python/ray/dashboard/client/src/pages/node/NodeRow.tsx has 411 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
No typecheck script — test ✓ · lint ✓ · typecheck ✗ — read from this repository's package.json scripts and corroborated against its CI workflows. A script counts when its name or command matches the step: `test` for the suite, `lint` or `prettier` for linting, `typecheck`/`type-check`/`tsc` for type checking. ✗ therefore means no script or CI step under those names was found, NOT that the step is absent from your pipeline — a task invoked by a runner this check does not read, or named something else entirely, is not seen and is worth confirming before acting on a cross. A ✓ means the wiring is DECLARED — a script or CI step under those names exists. It is not a statement that the step passes, or that it runs at all: nothing here installs a dependency or executes a suite.
Dead file (~123 LoC) python/ray/dashboard/client/src/pages/actor/hook/mockedUseActorList.ts— no import path from any entry point (3 application, 10 tooling, 41 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~88 LoC) python/ray/dashboard/client/src/common/SortableTableHead.tsx— no import path from any entry point (3 application, 10 tooling, 41 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~63 LoC) python/ray/dashboard/client/src/pages/serve/mockServeApplication.ts— no import path from any entry point (3 application, 10 tooling, 41 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~52 LoC) python/ray/dashboard/client/src/common/AlertDialog.tsx— no import path from any entry point (3 application, 10 tooling, 41 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~48 LoC) python/ray/dashboard/client/src/common/NumberedLines.tsx— no import path from any entry point (3 application, 10 tooling, 41 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~42 LoC) python/ray/dashboard/client/src/common/LabeledDatum.tsx— no import path from any entry point (3 application, 10 tooling, 41 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~37 LoC) python/ray/dashboard/client/src/common/UsageStatsAlert.tsx— no import path from any entry point (3 application, 10 tooling, 41 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~35 LoC) python/ray/dashboard/client/src/pages/error/404.tsx— no import path from any entry point (3 application, 10 tooling, 41 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~29 LoC) python/ray/dashboard/client/src/pages/job/hook/mockedUseJobList.ts— no import path from any entry point (3 application, 10 tooling, 41 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~25 LoC) python/ray/dashboard/client/src/common/ExpandControls.tsx— no import path from any entry point (3 application, 10 tooling, 41 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~13 LoC) python/ray/dashboard/client/src/common/TableCell.tsx— no import path from any entry point (3 application, 10 tooling, 41 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (python/ray/dashboard/client/src/common/SortableTableHead.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~11 LoC) python/ray/dashboard/client/src/common/SpanButton.tsx— no import path from any entry point (3 application, 10 tooling, 41 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~6 LoC) python/ray/dashboard/client/src/service/cluster.ts— no import path from any entry point (3 application, 10 tooling, 41 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~1 LoC) python/ray/dashboard/client/src/pages/job/JobTaskNameProgressTable/index.ts— no import path from any entry point (3 application, 10 tooling, 41 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Unused dependency '@emotion/react' — Declared in python/ray/dashboard/client/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
Unused dependency '@emotion/styled' — Declared in python/ray/dashboard/client/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
Unused dependency '@reduxjs/toolkit' — Declared in python/ray/dashboard/client/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
X1 · Async correctness· Task from `asyncio.get_running_loop().create_task` is not kept · ×1
Task from `asyncio.get_running_loop().create_task` is not kept doc/source/core/doc_code/actor-http-server.py:11— 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.
Orphaned file python/ray/autoscaler/v2/instance_manager/node_provider.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 python/ray/rllib/models/torch/attention_net.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 release/air_tests/air_benchmarks/workloads/torch_benchmark.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 python/ray/rllib/models/modelv2.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 python/ray/tune/search/ax/ax_search.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 python/ray/rllib/algorithms/dqn/dqn_tf_policy.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 python/ray/rllib/algorithms/sac/torch/sac_torch_learner.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 python/ray/tune/utils/file_transfer.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 python/ray/rllib/env/external_env.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file python/ray/rllib/algorithms/dqn/dqn_torch_policy.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 python/ray/util/spark/utils.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 python/ray/rllib/offline/json_reader.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 REDACTED: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 python/ray/rllib/connectors/connector.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 python/ray/train/_internal/worker_group.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 python/ray/rllib/env/base_env.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file python/ray/rllib/algorithms/impala/torch/impala_torch_learner.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 java/runtime/src/main/java/io/ray/runtime/AbstractRayRuntime.java: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 python/ray/rllib/connectors/connector_pipeline_v2.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 python/ray/rllib/offline/offline_evaluation_runner.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 python/ray/rllib/algorithms/dreamerv3/utils/summaries.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 python/ray/data/util/jax_util.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 python/ray/rllib/policy/tf_mixins.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 python/ray/rllib/connectors/common/add_states_from_episodes_to_batch.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 python/ray/rllib/evaluation/episode_v2.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.
Interpolated log message defeats structured logging release/ray_release/command_runner/_anyscale_job_wrapper.py:67— `warning` at line 67 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 release/ray_release/command_runner/_anyscale_job_wrapper.py:80— `warning` at line 80 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 release/ray_release/command_runner/_anyscale_job_wrapper.py:141— `info` at line 141 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 release/ray_release/command_runner/_anyscale_job_wrapper.py:159— `error` at line 159 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 release/ray_release/command_runner/_anyscale_job_wrapper.py:166— `error` at line 166 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 release/ray_release/command_runner/_anyscale_job_wrapper.py:201— `info` at line 201 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 release/ray_release/command_runner/_anyscale_job_wrapper.py:215— `info` at line 215 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 release/ray_release/command_runner/_anyscale_job_wrapper.py:225— `warning` at line 225 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 release/ray_release/command_runner/_anyscale_job_wrapper.py:230— `info` at line 230 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 release/ray_release/command_runner/_anyscale_job_wrapper.py:258— `error` at line 258 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 release/ray_release/command_runner/_anyscale_job_wrapper.py:262— `info` at line 262 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 release/ray_release/command_runner/_anyscale_job_wrapper.py:284— `error` at line 284 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 release/ray_release/command_runner/_anyscale_job_wrapper.py:293— `error` at line 293 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 release/ray_release/command_runner/_anyscale_job_wrapper.py:296— `error` at line 296 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 release/ray_release/command_runner/_anyscale_job_wrapper.py:313— `error` at line 313 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 release/ray_release/command_runner/_anyscale_job_wrapper.py:318— `error` at line 318 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 release/ray_release/command_runner/_anyscale_job_wrapper.py:351— `error` at line 351 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 release/ray_release/command_runner/_anyscale_job_wrapper.py:386— `error` at line 386 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 release/ray_release/command_runner/_anyscale_job_wrapper.py:405— `error` at line 405 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 release/ray_release/command_runner/_anyscale_job_wrapper.py:421— `error` at line 421 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 release/ray_release/command_runner/_anyscale_job_wrapper.py:425— `info` at line 425 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 release/ray_release/command_runner/_anyscale_job_wrapper.py:436— `error` at line 436 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 release/ray_release/command_runner/_anyscale_job_wrapper.py:443— `error` at line 443 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 release/ray_release/command_runner/_anyscale_job_wrapper.py:449— `info` at line 449 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 release/ray_release/command_runner/_anyscale_job_wrapper.py:494— `error` at line 494 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.
Duplicated predicate REDACTED:283— `options.getBundleIndex() == -1 || options.getBundleIndex() >= 0 && options.getBundleIndex() < group.getBundles().size()` appears character-identically in 2 files — REDACTED, java/runtime/src/main/java/io/ray/runtime/task/NativeTaskSubmitter.java. 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 java/serve/src/main/java/io/ray/serve/config/ReplicaConfig.java:135— `rayActorOptions != null && !rayActorOptions.isEmpty()` appears character-identically in 2 files — java/serve/src/main/java/io/ray/serve/config/ReplicaConfig.java, java/serve/src/main/java/io/ray/serve/deployment/DeploymentVersion.java. 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 python/ray/dashboard/client/src/pages/layout/MainNavLayout.tsx:136— `!metricsContextLoaded || grafanaHost === "DISABLED"` appears character-identically in 3 files — python/ray/dashboard/client/src/pages/layout/MainNavLayout.tsx, python/ray/dashboard/client/src/pages/overview/cards/ClusterUtilizationCard.tsx, python/ray/dashboard/client/src/pages/overview/cards/NodeCountCard.tsx. 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 python/ray/dashboard/client/src/authentication/authentication.ts:52— `error.response?.status === 401 || error.response?.status === 403` appears character-identically in 2 files — python/ray/dashboard/client/src/authentication/authentication.ts, python/ray/dashboard/client/src/service/requestHandlers.ts. 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 python/ray/dashboard/client/src/pages/metrics/Metrics.tsx:190— `grafanaHost === undefined || !prometheusHealth` appears character-identically in 5 files — python/ray/dashboard/client/src/pages/metrics/Metrics.tsx, python/ray/dashboard/client/src/pages/overview/cards/ClusterUtilizationCard.tsx, python/ray/dashboard/client/src/pages/overview/cards/NodeCountCard.tsx, python/ray/dashboard/client/src/pages/serve/ServeDeploymentMetricsSection.tsx. 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 python/ray/dashboard/client/src/pages/job/JobProgressBar.tsx:81— `status === "SUCCEEDED" || status === "FAILED"` appears character-identically in 2 files — python/ray/dashboard/client/src/pages/job/JobProgressBar.tsx, python/ray/dashboard/client/src/pages/job/JobRow.tsx. 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 python/ray/dashboard/client/src/components/TaskTable.tsx:349— `task.state === "RUNNING" && task.worker_id` appears character-identically in 2 files — python/ray/dashboard/client/src/components/TaskTable.tsx, python/ray/dashboard/client/src/pages/task/TaskPage.tsx. 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 doc/source/_static/js/csat.js:9— `typeof window.dataLayer === 'undefined' || !Array.isArray(window.dataLayer)` appears character-identically in 2 files — doc/source/_static/js/csat.js, doc/source/_static/js/custom.js. 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 python/ray/_common/ray_option_utils.py:122— `"CPU" in resources or "GPU" in resources` appears character-identically in 2 files — python/ray/_common/ray_option_utils.py, REDACTED. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate python/ray/autoscaler/_private/kuberay/node_provider.py:152— `"containerStatuses" not in pod["status"] or not pod["status"]["containerStatuses"]` appears character-identically in 2 files — python/ray/autoscaler/_private/kuberay/node_provider.py, python/ray/autoscaler/v2/instance_manager/cloud_providers/kuberay/cloud_provider.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 python/ray/rllib/policy/dynamic_tf_policy.py:359— `"positional argument" in e.args[0] or "unexpected keyword argument" in e.args[0]` appears character-identically in 3 files — python/ray/rllib/policy/dynamic_tf_policy.py, python/ray/rllib/policy/eager_tf_policy.py, python/ray/rllib/policy/torch_policy.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:3149— `"worker" in state and "policy_states" in state["worker"]` appears character-identically in 2 files — REDACTED, REDACTED. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate python/ray/rllib/models/tf/complex_input_net.py:160— `SampleBatch.OBS in input_dict and "obs_flat" in input_dict` appears character-identically in 2 files — python/ray/rllib/models/tf/complex_input_net.py, python/ray/rllib/models/torch/complex_input_net.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 python/ray/rllib/policy/dynamic_tf_policy.py:195— `action_sampler_fn or action_distribution_fn` appears character-identically in 2 files — python/ray/rllib/policy/dynamic_tf_policy.py, python/ray/rllib/policy/eager_tf_policy.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 python/ray/rllib/models/tf/tf_action_dist.py:345— `action_space and action_space.shape == ()` appears character-identically in 2 files — python/ray/rllib/models/tf/tf_action_dist.py, python/ray/rllib/models/torch/torch_action_dist.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 python/ray/serve/_private/request_router/request_router.py:1332— `backoff_index >= 50 and backoff_index % 50 == 0` appears character-identically in 2 files — python/ray/serve/_private/request_router/request_router.py, python/ray/serve/experimental/consistent_hash_router.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 python/ray/llm/_internal/batch/processor/sglang_engine_proc.py:261— `config.accelerator_type or DEFAULT_GPU_TYPE` appears character-identically in 2 files — python/ray/llm/_internal/batch/processor/sglang_engine_proc.py, python/ray/llm/_internal/batch/processor/vllm_engine_proc.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 python/ray/rllib/policy/tf_mixins.py:274— `config.get("use_gae") or config.get("vtrace")` appears character-identically in 2 files — python/ray/rllib/policy/tf_mixins.py, python/ray/rllib/policy/torch_mixins.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 python/ray/rllib/policy/tf_policy.py:179— `config["_fake_gpus"] or num_gpus == 0 or not gpu_ids` appears character-identically in 3 files — python/ray/rllib/policy/tf_policy.py, python/ray/rllib/policy/torch_policy.py, python/ray/rllib/policy/torch_policy_v2.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 python/ray/data/_internal/progress/logging_progress.py:131— `contains_sub_progress_bars or verbose_progress` appears character-identically in 2 files — python/ray/data/_internal/progress/logging_progress.py, python/ray/data/_internal/progress/tqdm_progress.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:19— `content is None or isinstance(content, str)` appears character-identically in 2 files — REDACTED, python/ray/llm/_internal/serve/serving_patterns/prefill_decode/pd_server.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 python/ray/data/_internal/planner/random_shuffle.py:72— `ctx.target_max_block_size_override or data_context.target_max_block_size` appears character-identically in 2 files — python/ray/data/_internal/planner/random_shuffle.py, python/ray/data/_internal/planner/repartition.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 python/ray/tune/schedulers/hb_bohb.py:51— `cur_bracket is None or cur_bracket.filled()` appears character-identically in 2 files — python/ray/tune/schedulers/hb_bohb.py, python/ray/tune/schedulers/hyperband.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 python/ray/air/util/data_batch_conversion.py:240— `data.column_names == [TENSOR_COLUMN_NAME] and ( isinstance(data.schema.types[0], arrow_fixed_shape_tensor_types) )` appears character-identically in 2 files — python/ray/air/util/data_batch_conversion.py, python/ray/data/util/data_batch_conversion.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 python/ray/data/_internal/datasource/iceberg_datasource.py:639— `data_context or DataContext.get_current()` appears character-identically in 3 files — python/ray/data/_internal/datasource/iceberg_datasource.py, python/ray/data/_internal/datasource/lerobot_datasource.py, python/ray/data/_internal/datasource/zarrv2_datasource.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.
X23 · Unguarded diagnostic materialisation· Diagnostic log message is built whether or not it is wanted · ×12
Diagnostic log message is built whether or not it is wanted release/ray_release/reporter/db.py:50— `debug` at line 50 is called with an argument built by `json.dumps(result_json)` (line 50), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on.
Diagnostic log message is built whether or not it is wanted REDACTED:180— `debug` at line 180 is called with an argument built by `json.dumps(response)` (line 180), 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 python/ray/serve/_private/deployment_state.py:4012— `debug` at line 4012 is called with an argument built by `deployment_info.to_dict()` (line 4012), 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 python/ray/serve/_private/deployment_state.py:4013— `debug` at line 4013 is called with an argument built by `info.to_dict()` (line 4015), 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 python/ray/serve/_private/long_poll.py:279— `debug` at line 279 is called with an argument built by `list(updates.keys())` (line 280), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on.
Diagnostic log message is built whether or not it is wanted REDACTED:1175— `debug` at line 1175 is called with an argument built by `[self._get_partition_stats(pid) for pid in target_partition_ids]` (line 1177), 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 python/ray/data/_internal/execution/operators/lineage_reconstruction_mixin.py:149— `debug` at line 149 is called with an argument built by `sorted(held_blocks, key = lambda slot : (slot.parent_lineage_task_id, slot.output_index,),)` (line 156), 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 python/ray/data/_internal/datasource_v2/common/online_bin_packer.py:394— `debug` at line 394 is called with an argument built by `[item.file.path if item.run is None else (item.file.path, item.run.unit_ids) for item in bin_.items]` (line 401), 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 python/ray/data/_internal/cluster_autoscaler/rate_based_cluster_autoscaler.py:616— `debug` at line 616 is called with an argument built by `"…".join(formatted_bundles)` (line 616), 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 python/ray/autoscaler/v2/event_logger.py:110— `debug` at line 110 is called with an argument built by `dict(cluster_resources)` (line 110), 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 python/ray/autoscaler/_private/command_runner.py:450— `verbose` at line 450 is called with an argument built by `"…".join(command)` (line 450), 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 verbose 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 python/ray/autoscaler/_private/command_runner.py:475— `verbose` at line 475 is called with an argument built by `"…".join(command)` (line 475), 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 verbose 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.
Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 22 significant file(s) lose their only recent owner: REDACTED, python/ray/llm/_internal/serve/benchmark/interactive.py, ci/raydepsets/cli.py, release/serve_tests/workloads/router_microbenchmark.py, python/ray/llm/_internal/serve/engines/vllm/kv_transfer/moriio.py, python/ray/serve/experimental/consistent_hash_router.py, release/serve_tests/workloads/plot_router_benchmark.py, release/llm_tests/kv_router_test/utils.py (+14 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 5 significant file(s) lose their only recent owner: python/ray/train/v2/_internal/callbacks/nccl_ras.py, python/ray/rllib/connectors/common/flatten_observations.py, ci/lint/pytest_checker.py, ci/lint/check_bazel_team_owner.py, python/ray/_private/runtime_env/plugin_schema_manager.py. Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #3 — If anonymized user #3 becomes unavailable, 5 significant file(s) lose their only recent owner: python/ray/train/v2/_internal/execution/preemption.py, python/ray/train/tensorflow/keras.py, python/ray/train/v2/_internal/callbacks/preemption_callback.py, python/ray/train/xgboost/xgboost_checkpoint.py, python/ray/train/v2/_internal/execution/callback_manager.py. Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #4 — If anonymized user #4 becomes unavailable, 5 significant file(s) lose their only recent owner: python/ray/data/_internal/scheduling_overhead.py, python/ray/train/_internal/autoscaling_coordinator_client.py, python/ray/train/v2/_internal/execution/scaling_policy/autoscaling_coordinator_client.py, release/nightly_tests/dataset/text_embedding/main.py, python/ray/data/_internal/utils/heapdict.py. Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #5 — If anonymized user #5 becomes unavailable, 4 significant file(s) lose their only recent owner: release/ray_release/byod/build_context.py, release/ray_release/cloud_util.py, release/ray_release/exception.py, release/ray_release/result.py. Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #6 — If anonymized user #6 becomes unavailable, 3 significant file(s) lose their only recent owner: python/ray/dashboard/modules/task_events/task_event_storage.py, python/ray/dashboard/modules/task_events/ray_event_converter.py, python/ray/dashboard/modules/task_events/task_events_head.py. Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #7 — If anonymized user #7 becomes unavailable, 3 significant file(s) lose their only recent owner: python/ray/llm/_internal/serve/core/configs/accelerators.py, python/ray/_private/label_utils.py, python/ray/air/_internal/device_manager/__init__.py. Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #8 — If anonymized user #8 becomes unavailable, 3 significant file(s) lose their only recent owner: ci/ray_ci/automation/copy_wanda_image.py, ci/ray_ci/automation/image_tags_lib.py, ci/ray_ci/automation/extract_wanda_artifact.py. Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #9 — If anonymized user #9 becomes unavailable, 5 significant file(s) lose their only recent owner: python/ray/data/_internal/usage/collector.py, python/ray/data/_internal/usage/execution_callback.py, python/ray/data/_internal/usage/util.py, python/ray/data/_internal/usage/poller.py, python/ray/data/_internal/usage/actor.py. Pair on, review, or document these before any departure.
Silent fallback default in catch ci/ray_ci/doc/cmd_check_api_discrepancy.py:329— `_immediate_child_modules` 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 python/ray/_private/utils.py:947— `get_user` 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 python/ray/_private/utils.py:1571— `get_entrypoint_name` swallows every exception into `return 'unknown'` — 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 python/ray/autoscaler/_private/cli_logger.py:223— `_isatty` 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 python/ray/data/_internal/datasource/huggingface_datasource.py:111— `list_parquet_urls_from_dataset` 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 python/ray/serve/_private/thirdparty/get_asgi_route_name.py:224— `extract_route_patterns` 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 python/ray/serve/tests/test_config_files/flex_deployment_actor.py:17— `__call__` swallows every exception into `return 'no_actor'` — 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 python/ray/dashboard/client/src/components/AutoscalerStatusCards.tsx:21— `formatNodeStatus` swallows every exception into `return "No cluster status."` — 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 python/ray/dashboard/client/src/components/AutoscalerStatusCards.tsx:38— `formatResourcesStatus` swallows every exception into `return "No cluster status."` — 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 REDACTED:272— `get_call_location` returns `'UNKNOWN'` when `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 python/ray/_private/thirdparty/tabulate/tabulate.py:1308— `_bool` returns `False` when `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 python/ray/data/_internal/datasource/json_datasource.py:269— `_estimate_chunksize` returns `1` when `StopIteration` 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:1671— `safe_int` (in `_parse_haproxy_csv_stats`) 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.
Fat interface: RayRuntime (35 abstract methods) java/api/src/main/java/io/ray/api/runtime/RayRuntime.java:35— `RayRuntime` declares 35 abstract methods: `call`, `call`, `call`, `callActor`, `callActor`, `callActor`, `createActor`, `createActor`, `createActor`, `createConcurrencyGroup`, `createPlacementGroup`, `createRuntimeEnv`, `deserializeRuntimeEnv`, `exitActor`, `extractConcurrencyGroups`, `get`, `get`, `get`, `get`, `getActor`, `getActorHandle`, `getAllPlacementGroups`, `getAvailableResourceIds`, `getCurrentNodeId`, `getNamespace`, `getParallelActorContext`, `getPlacementGroup`, `getPlacementGroup`, `getRuntimeContext`, `killActor`, `put`, `removePlacementGroup`, `shutdown`, `wait`, `waitPlacementGroupReady`. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. Those 35 declarations carry 25 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 25 operations clears the >15 bar on its own, so the row is about responsibilities, not signatures. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
D16 · Bus Factor· Further sole-owners (lower concentration) · ×1
Further sole-owners (lower concentration) — 33 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 (102 single-owned of 1699 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; 1699 of the 2821 production source files in this repository met that bar). They are anonymized user #10 (4 file(s)), anonymized user #11 (2 file(s)), anonymized user #12 (2 file(s)), anonymized user #13 (2 file(s)), anonymized user #14 (2 file(s)), anonymized user #15 (3 file(s)) (+27 more) — spread or document their files in the same way, at lower priority than the named off-boarding risks above. The files folded here: python/ray/data/_internal/dynamic_work_queue.py, python/ray/data/_internal/logical/ruleset.py, python/ray/data/_internal/datasource_v2/common/size_estimators.py, python/ray/data/_internal/weighted_round_robin.py, REDACTED, release/ray_release/buildkite/concurrency.py, python/ray/dashboard/modules/platform_events/providers/k8s_provider.py, python/ray/dashboard/modules/platform_events/platform_event_head.py (+39 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 — 5 of 10 project(s) overshoot their size bounds, lowering Project Cohesion to 0.0/10. The most over is `python` (566523 LoC, 4570 module-visible types across 366 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.
D28 · Secrets (history)· Rotate the exposed credentials · ×1
D34 · Knowledge Freshness· Further orphaned files (smaller) · ×1
Further orphaned files (smaller) — 437 smaller file(s) also have no living knowledge — folded into the freshness score and metrics rather than raised one row each — most significant first: python/ray/autoscaler/v2/instance_manager/node_provider.py, python/ray/rllib/models/torch/attention_net.py, release/air_tests/air_benchmarks/workloads/torch_benchmark.py, python/ray/rllib/models/modelv2.py, python/ray/tune/search/ax/ax_search.py, python/ray/rllib/algorithms/dqn/dqn_tf_policy.py, python/ray/rllib/algorithms/sac/torch/sac_torch_learner.py, python/ray/tune/utils/file_transfer.py (and 429 more) (469 orphaned of 1703 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; 1703 of the 2821 production source files in this repository met that bar). Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
D40 · Network Egress Confinement· No network policy · ×1
No network policy — No Kubernetes NetworkPolicy (or Cilium policy) found. Without one, every pod can talk to every other pod and reach out to the internet by default. Add a default-deny policy and open only the flows you need.
No ADRs — No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
P10 · Library API & versioning· Large public API surface · ×1
Large public API surface — 237/259 types (92%) declared in the published library are public. For a library, every public type is a stability contract — keep implementation types off the surface and expose only the intended API.
No SAST — No static application security testing detected. For this repository's stack, add bandit, `semgrep --config=p/python`, or CodeQL's python pack as a CI step. What was searched, so you can tell an absence from a miss: the 173844 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.
P4 · Deployment & Rollback· No rollback/health safety · ×1
No rollback/health safety — Deployment automation exists and the service already exposes health probe endpoints (healthz/livez/readyz or a container healthcheck), but no manifest in this repository wires them into readiness/liveness probes, a rolling-update strategy, lifecycle hooks or a migration job — a bad release is harder to detect and reverse. If that wiring lives in a separate ops/Helm repository, document the pointer here so release safety is evidenced.
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.)
Unused export 'MiBRatio' python/ray/dashboard/client/src/common/formatUtils.ts:33— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'MiBRatioNoPercent' · ×1
Unused export 'MiBRatioNoPercent' python/ray/dashboard/client/src/common/formatUtils.ts:36— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'formatDuration' · ×1
Unused export 'formatDuration' python/ray/dashboard/client/src/common/formatUtils.ts:39— Nothing imports this binding — it is safe to review for removal.
Unused export 'mapObj' python/ray/dashboard/client/src/common/util.ts:27— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'brpcLinkChanger' · ×1
Unused export 'brpcLinkChanger' REDACTED:130— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'getPipelineEvents' · ×1
Unused export 'getPipelineEvents' python/ray/dashboard/client/src/service/event.ts:10— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'getNamespaces' · ×1
Unused export 'getNamespaces' python/ray/dashboard/client/src/service/util.ts:50— Nothing imports this binding — it is safe to review for removal.
Unused export 'JobDetail' python/ray/dashboard/client/src/type/job.ts:53— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'JobProgressRsp' · ×1
Unused export 'JobProgressRsp' python/ray/dashboard/client/src/type/job.ts:104— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'JobProgressByTaskNameRsp' · ×1
Unused export 'JobProgressByTaskNameRsp' python/ray/dashboard/client/src/type/job.ts:116— Nothing imports this binding — it is safe to review for removal.
Unused export 'jsonFormat' python/ray/dashboard/client/src/util/func.tsx:10— Nothing imports this binding — it is safe to review for removal.
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 0/2 async functions that make a cancellable request (fetch, axios, ky, ofetch) 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.
Hand-rolled JSON/XML parsing via regex ci/lint/pytest_checker.py:9— 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.
Appendix B — Reproduction & audit trail
Every external tool invocation behind a deep-scan dimension — the tool, its captured version, the exact command, how many findings it yielded, and a link to the retained raw output. To reproduce any finding: check out the same commit and run the command shown (repo-relative — never an absolute scratch path). The complete raw scanner output is retained verbatim under artifacts/raw/ (indexed in artifacts/raw/index.json); per-invocation exit codes and wall-clock durations are in sidecar.json — kept out of this table so the rendered report stays byte-identical across runs of the same commit.
semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that. semgrep could not parse 1 file(s) — `python/ray/dashboard/client/public/speedscope-1.5.3/speedscope.75eb7d8e.js` — so the PII/GDPR sweep did not cover them at all.
runtime-hardening: not applicable — The repository ships application workloads but no cluster-governance resources (CRDs, admission webhooks, or a committed policy engine). Runtime threat-detection (Falco/Tetragon) and admission control (Kyverno/OPA-Gatekeeper/PodSecurity) are cluster-OPERATOR controls owned by the platform, not shipped by an application repo/chart — nothing for this repo to assess.
Run 01a17259-ce29-7799-8a17-4acf729e71ca · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 276 · Warnings: 4279 · Recommendations: 634 — Appendix A · all findings · full markdown report.
Generated by Watchdog — deterministic code-health analysis. 25-10-2026 @ 09:17 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.