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

gfx-rs/wgpu

Measured 26 October 2026, 04:36 UTC, at code version 100c142

No regression since the last survey

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

CAI score 70out of 100 Adequate
CriticalWeakAdequateStrongExemplary
Down 4 since the last survey

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

A large codebase: 264,693 lines of product code in 24 projects, tests not counted · Estimated rebuild effort: about 3.0 person-years · Weakest lens: Maturity, 64

Findings by how serious they are

33 critical 1513 serious 47 minor

12 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
26 October 2026, 04:36 UTC

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

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

61of 61 dimensions measured by tools.
1573of 1593 findings point to an exact file and line, so you can open each one in the code. The other 20 concern the repository as a whole, such as missing documentation.
61dimensions across 6 lenses, read from 264,693 lines of product code in 24 projects.
Chapters

Executive summary

gfx-rs/wgpu falls short of our standard for production because the project keeps no record of its design decisions and the documentation refers to three links that don't exist. It scores 70 out of 100 and is rated Adequate, and 21 of its 33 critical findings are security problems in the build pipeline and in its automatic dependency updates.

Maturity, at 64, is the weakest lens and counts most in the score. The best first step is recording design decisions, worth about 6 points. Having someone learn and document the four files no active contributor knows comes next, worth about 2 points. Raising Maturity to 70 would lift the score to about 72.

Sixteen pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. Four pipeline steps run downloads nobody checks, and eight sets of files in separate parts keep changing together, which points to hidden dependencies. Pinning each tool to an exact version, checking each download against a checksum and making the hidden dependencies explicit would close these risks. Setting a waiting period for automatic updates would fix the automatic dependency update that takes a new release at once.

The product code is 264,693 lines, about €430,000 to rebuild.

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

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

If Maturity rose from 64 to 70, the lowest score rated Strong, the score would rise from 70 to about 72.

Code composition: what the lines of code are
Product code 80%Tests 20%
New since the last survey: 12 findings

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

  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) naga/src/back/dot/mod.rs
  • Code Duplication · Duplicated block (12–16 lines × 2) wgpu-core/src/device/resource.rs
  • Code Duplication · Duplicated block (11–14 lines × 5) wgpu-core/src/device/resource.rs
  • Code Duplication · Duplicated block (11 lines × 2) wgpu-core/src/command/render.rs
  • Code Duplication · Duplicated block (10 lines × 2) naga/src/back/spv/writer.rs
  • Churn × Complexity Hotspots · Hotspot: naga/src/valid/type.rs naga/src/valid/type.rs
  • Explicit Debt · TodoComment wgpu-core/src/command/clear.rs
  • Explicit Debt · TodoComment repeated across 17 files deno_webgpu/bind_group.rs
  • Knowledge Freshness · Orphaned knowledge naga/src/front/spv/image.rs
  • Change Coupling · Change coupling: buffer.rs ↔ texture.rs wgpu-core/src/track/buffer.rs
  • Change Coupling · Change coupling clique: dispatch.rs, draw.rs, mod.rs wgpu-core/src/indirect_validation/dispatch.rs
  • Change Coupling · Change coupling: buffer.rs ↔ stateless.rs wgpu-core/src/track/buffer.rs

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: 15 findings

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

  • God Classes · MethodTooLong: CommandEncoder.begin_render_pass wgpu-hal/src/vulkan/command.rs
  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) naga/src/back/dot/mod.rs
  • Code Duplication · Duplicated block (9 lines × 2) wgpu-core/src/indirect_validation/dispatch.rs
  • Code Duplication · Duplicated block (9 lines × 2) wgpu-core/src/indirect_validation/dispatch.rs
  • Code Duplication · Duplicated block (8 lines × 2) naga/src/proc/namer.rs
  • Churn × Complexity Hotspots · Repeated repair: wgpu-core/src/command/pass.rs wgpu-core/src/command/pass.rs
  • Explicit Debt · TodoComment repeated across 17 files deno_webgpu/texture.rs
  • Explicit Debt · TodoComment wgpu-core/src/command/clear.rs
  • Explicit Debt · TodoComment wgpu-core/src/command/clear.rs
  • Explicit Debt · FixmeComment wgpu/src/backend/wgpu_core.rs
  • Change Coupling · Boundary-crossing change coupling: pipeline_cache.rs ↔ webgpu.rs wgpu-core/src/pipeline_cache.rs
  • Change Coupling · Boundary-crossing change coupling: pipeline_cache.rs ↔ lib.rs wgpu-core/src/pipeline_cache.rs
  • Change Coupling · Boundary-crossing change coupling: pipeline_cache.rs ↔ mod.rs wgpu-core/src/pipeline_cache.rs
  • Change Coupling · Change coupling clique: buffer.rs, stateless.rs, texture.rs wgpu-core/src/track/buffer.rs
  • Change Coupling · Change coupling: draw.rs ↔ mod.rs wgpu-core/src/indirect_validation/draw.rs
Rebuild cost: about €430,000 · Estimate
Cost to rebuild€140,000 to €720,000, for 2,395 to 7,598 hours of work, about 3.0 person-years for 1 to 6 engineers
Difficulty of the problemStandard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor×1.0 at a score of 70. 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.
SizeLarge: 264,693 lines of product code
What it is notNot a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.

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

Top priorities

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

1
Resolve the 1 No ADRs found finding(s) in ADR Quality.
Raises the score by about 6 points · Low effort · ADR Quality
2
Resolve the 4 Orphaned knowledge finding(s) in Knowledge Freshness — start with image.rs, storage.rs, declarations.rs.
Raises the score by about 2 points · Low effort · Knowledge Freshness
3
Reconcile the README with reality: wgpu-hal/README.md links to `vulkan/struct.Api.html`, but `wgpu-hal/vulkan/struct.Api.html` does not exist; wgpu-hal/README.md links to `metal/struct.Api.html`, but `wgpu-hal/metal/struct.Api.html` does not exist; wgpu-hal/README.md links to `gles/index.html`, but `wgpu-hal/gles/index.html` does not exist.
Raises the score by about 4 points · Medium effort · Documentation accuracy

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 €430,000 to build again, about 3.0 person-years of work. Its weakest lens is Maturity, at 64 (Adequate). Maturity is about how well the project explains and looks after itself, which decides whether a new developer, or a new supplier, can take over. Because the weakest lens counts most in the score, work on Maturity also moves the score most.
Based on: the rebuild estimate · the Maturity grade · how much each lens counts
What to do: Start with the Maturity actions in Top priorities.
If you do one thing first · First action
Resolve the 1 No ADRs found finding(s) in ADR Quality. Of all the actions in this report, it raises the score most for the work it takes: about 6 points for low effort, because it clears the 1 ADR Quality findings. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 6.6 out of 10. Code at that level is slower to change than clean code, and Watchdog estimates the extra work at 4% to 8% on every change. The history of the code shows how much it changes: about 69,321 lines over the last 90 days, which is about 281,135 lines a year. At that pace, the extra work comes to an estimated 25.1 to 150.5 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of Watchdog's own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.

Architecture — module dependency graph

Project dependencies, layered top-to-bottom; arrows show direction. Any dashed red edge points upward or sideways, which only happens where the projects form a dependency cycle. A graph without cycles has none.

arch cts_runner cts_runner deno_webgpu deno_webgpu cts_runner->deno_webgpu wgpu-hal wgpu-hal cts_runner->wgpu-hal wgpu-core wgpu-core deno_webgpu->wgpu-core wgpu-types wgpu-types deno_webgpu->wgpu-types hlsl-snapshots hlsl-snapshots naga naga naga-types naga-types naga->naga-types naga-cli naga-cli naga-cli->naga player player player->wgpu-core player->wgpu-types wgpu wgpu wgpu->naga wgpu->wgpu-core wgpu->wgpu-hal wgpu-sync wgpu-sync wgpu->wgpu-sync wgpu->wgpu-types wgpu-core->naga wgpu-core->naga-types wgpu-core-deps-apple wgpu-core-deps-apple wgpu-core->wgpu-core-deps-apple wgpu-core-deps-emscripten wgpu-core-deps-emscripten wgpu-core->wgpu-core-deps-emscripten wgpu-core-deps-linux-android-bsd wgpu-core-deps-linux-android-bsd wgpu-core->wgpu-core-deps-linux-android-bsd wgpu-core-deps-wasm wgpu-core-deps-wasm wgpu-core->wgpu-core-deps-wasm wgpu-core-deps-windows wgpu-core-deps-windows wgpu-core->wgpu-core-deps-windows wgpu-core->wgpu-hal wgpu-naga-bridge wgpu-naga-bridge wgpu-core->wgpu-naga-bridge wgpu-core->wgpu-sync wgpu-core->wgpu-types wgpu-core-deps-apple->wgpu-hal wgpu-core-deps-emscripten->wgpu-hal wgpu-core-deps-linux-android-bsd->wgpu-hal wgpu-core-deps-wasm->wgpu-hal wgpu-core-deps-windows->wgpu-hal wgpu-core-remote wgpu-core-remote wgpu-core-remote->wgpu-core wgpu-core-remote-types wgpu-core-remote-types wgpu-core-remote->wgpu-core-remote-types wgpu-core-remote->wgpu-hal wgpu-core-remote->wgpu-types wgpu-core-remote-types->naga-types wgpu-core-remote-types->wgpu-types wgpu-hal->naga wgpu-hal->naga-types wgpu-hal->wgpu-naga-bridge wgpu-hal->wgpu-sync wgpu-hal->wgpu-types wgpu-naga-bridge->naga wgpu-naga-bridge->wgpu-types wgpu-types->naga-types __more__ +4 more projects

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.

451 modules, with 2279 dependencies between them. One loop runs through 205 of the modules, marked above the diagonal.

The table shows the 40 modules with the most connections; 411 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.
uses →1 wgpu_types.features2 wgpu_types.limits3 naga.arena.range4 wgpu_types.error5 wgpu_types.texture.format6 naga.span7 naga.front.wgsl.lower8 wgpu_core.pipeline9 wgpu_hal.dx1210 wgpu_hal.gles11 wgpu_types.render12 wgpu_types.texture13 wgpu_types.origin_extent14 wgpu_core.device.queue15 wgpu_core.command16 wgpu_core.command.render17 wgpu_core.resource18 wgpu.backend.webgpu19 wgpu.backend.wgpu_core20 wgpu.dispatch21 wgpu.api.render_pipeline22 wgpu.api.device23 wgpu.api.buffer24 wgpu.api.bind_group25 wgpu_hal.vulkan26 player27 wgpu_hal28 naga.valid29 wgpu_core_remote.global30 wgpu_hal.noop31 naga_cli.bin.naga32 naga.front.wgsl.parse.ast33 wgpu_hal.metal34 naga.back.glsl35 naga.back.spv36 wgpu_core.device.resource37 naga.ir38 naga.arena.unique_arena39 naga.arena.handle40 naga.arena
1 wgpu_types.features
2 wgpu_types.limits
3 naga.arena.range11
4 wgpu_types.error2
5 wgpu_types.texture.format1311
6 naga.span113
7 naga.front.wgsl.lower4861643
8 wgpu_core.pipeline10138120841
9 wgpu_hal.dx1222354115322322425213
10 wgpu_hal.gles32444110344231541921
11 wgpu_types.render32
12 wgpu_types.texture241321
13 wgpu_types.origin_extent111
14 wgpu_core.device.queue142212822
15 wgpu_core.command10131217411
16 wgpu_core.command.render361118217453413
17 wgpu_core.resource1244111811425
18 wgpu.backend.webgpu34414121318627221911
19 wgpu.backend.wgpu_core2331324103147232229
20 wgpu.dispatch2331337322929217
21 wgpu.api.render_pipeline241
22 wgpu.api.device1111311231233
23 wgpu.api.buffer33122
24 wgpu.api.bind_group13
25 wgpu_hal.vulkan2242121138371
26 player13111112
27 wgpu_hal233636151962332611
28 naga.valid12268221
29 wgpu_core_remote.global12121251421125
30 wgpu_hal.noop1111212111113
31 naga_cli.bin.naga2212
32 naga.front.wgsl.parse.ast4137131
33 wgpu_hal.metal214214411111113
34 naga.back.glsl13212
35 naga.back.spv1225526151
36 wgpu_core.device.resource13121213111341
37 naga.ir21642142
38 naga.arena.unique_arena221
39 naga.arena.handle11
40 naga.arena121
Uses a module listed above itPart of a loopThe module itself
1 wgpu_types.features2 wgpu_types.limits3 naga.arena.range4 wgpu_types.error5 wgpu_types.texture.format6 naga.span7 naga.front.wgsl.lower8 wgpu_core.pipeline9 wgpu_hal.dx1210 wgpu_hal.gles11 wgpu_types.render12 wgpu_types.texture13 wgpu_types.origin_extent14 wgpu_core.device.queue15 wgpu_core.command16 wgpu_core.command.render17 wgpu_core.resource18 wgpu.backend.webgpu19 wgpu.backend.wgpu_core20 wgpu.dispatch21 wgpu.api.render_pipeline22 wgpu.api.device23 wgpu.api.buffer24 wgpu.api.bind_group25 wgpu_hal.vulkan26 player27 wgpu_hal28 naga.valid29 wgpu_core_remote.global30 wgpu_hal.noop31 naga_cli.bin.naga32 naga.front.wgsl.parse.ast33 wgpu_hal.metal34 naga.back.glsl35 naga.back.spv36 wgpu_core.device.resource37 naga.ir38 naga.arena.unique_arena39 naga.arena.handle40 naga.arenawgpu_types.features1wgpu_types.limits2naga.arena.range3wgpu_types.error4wgpu_types.texture.format5naga.span6naga.front.wgsl.lower7wgpu_core.pipeline8wgpu_hal.dx129wgpu_hal.gles10wgpu_types.render11wgpu_types.texture12wgpu_types.origin_extent13wgpu_core.device.queue14wgpu_core.command15wgpu_core.command.render16wgpu_core.resource17wgpu.backend.webgpu18wgpu.backend.wgpu_core19wgpu.dispatch20wgpu.api.render_pipeline21wgpu.api.device22wgpu.api.buffer23wgpu.api.bind_group24wgpu_hal.vulkan25player26wgpu_hal27naga.valid28wgpu_core_remote.global29wgpu_hal.noop30naga_cli.bin.naga31naga.front.wgsl.parse.ast32wgpu_hal.metal33naga.back.glsl34naga.back.spv35wgpu_core.device.resource36naga.ir37naga.arena.unique_arena38naga.arena.handle39naga.arena4011213111134861643101381208412235411532232242521332444110344231541921322413211111422128221013121741136111821745341312441118114253441412131862722191123313241031472322292331337322929217241111131123123333122132242121138371131111122336361519623326111226822112121251421125111121211111322124137131214214411111113132121225526151131212131113412164214222111121+411 more modules (most-connected shown)

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

At a glance — Architecture · 93% · Exemplary ·

At a glance — Maturity · 64% · Adequate ·

At a glance — Readiness · 78% · Strong ·

At a glance — Security · 67% · Adequate · gated by D29, D36 ·

At a glance — Performance · 86% · Strong ·

Security & Compliance — OWASP Top-10 mapping

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

OWASP categoryFindingsSeverity
A05:2025 — Injection21High / Critical
A03:2025 — Software Supply Chain Failures13Medium

Roadmap

First, address the missing architecture decision records by documenting key design choices and resolving the single gap in ADR quality. Next, fix the 16 static analysis issues in the CI workflows, prioritizing REDACTED, and update the README to remove broken links to non-existent API documentation. Finally, resolve the four instances of orphaned knowledge by refreshing stale references in image.rs, storage.rs, and declarations.rs.

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

Do thisHelpsEffortDimension
Resolve the 1 No ADRs found finding(s) in ADR Quality.+5.9 ptsLowADR Quality
Resolve the 4 Orphaned knowledge finding(s) in Knowledge Freshness — start with image.rs, storage.rs, declarations.rs.+2.5 ptsLowKnowledge Freshness
Reconcile the README with reality: wgpu-hal/README.md links to `vulkan/struct.Api.html`, but `wgpu-hal/vulkan/struct.Api.html` does not exist; wgpu-hal/README.md links to `metal/struct.Api.html`, but `wgpu-hal/metal/struct.Api.html` does not exist; wgpu-hal/README.md links to `gles/index.html`, but `wgpu-hal/gles/index.html` does not exist.+4.4 ptsMediumDocumentation accuracy
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.+3.5 ptsMediumArchitecture documentation
Resolve the 1 End-of-life runtime finding(s) in Platform End-of-Life — start with rust-toolchain.toml.+1.5 ptsLowPlatform End-of-Life
Resolve the 16 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (10), REDACTED (3), REDACTED (2).+2.7 ptsMediumStatic Analysis (SAST)
Resolve the 37 Hotspot finding(s) in Churn × Complexity Hotspots — start with writer.rs (5), adapter.rs (4), resource.rs (2).+1.6 ptsHighChurn × Complexity Hotspots
Add an 'Architecture' / 'How it works' section to the root README — the high-level shape.+1.5 ptsMediumDocumentation (README)

File quality

Per-file score 0–10 — a quality signature. Of 217 files carrying findings, judged against the Production bar: 2% slop · 69% mixed · 29% near-clean.

FileScoreBandWorst signal
wgpu-hal/src/vulkan/adapter.rs1.4SlopChange Coupling: Boundary-crossing change coupling: adapter.rs ↔ human.rs
wgpu-hal/src/gles/adapter.rs1.6SlopChange Coupling: Boundary-crossing change coupling: adapter.rs ↔ human.rs
wgpu-hal/src/metal/adapter.rs2.3SlopChange Coupling: Boundary-crossing change coupling: adapter.rs ↔ human.rs
wgpu-hal/src/dx12/adapter.rs2.4SlopChange Coupling: Boundary-crossing change coupling: adapter.rs ↔ human.rs
REDACTED4.4MixedStatic Analysis (SAST): High: REDACTED
REDACTED5.1MixedStatic Analysis (SAST): High: REDACTED
REDACTED5.1MixedStatic Analysis (SAST): High: REDACTED
wgpu-info/src/human.rs5.2MixedChange Coupling: Boundary-crossing change coupling: human.rs ↔ webgpu.rs
wgpu-core/src/indirect_validation/dispatch.rs5.5MixedGod Classes: MethodTooLong: Dispatch.new
deno_webgpu/webidl.rs5.8MixedChange Coupling: Boundary-crossing change coupling: webidl.rs ↔ adapter.rs
REDACTED5.8MixedStatic Analysis (SAST): High: REDACTED
REDACTED5.8MixedDependency Vulnerabilities: Medium advisory (unmaintained): REDACTED
naga/src/back/glsl/writer.rs6.0MixedExplicit Debt: TodoComment
naga/src/front/spv/next_block.rs6.0MixedExplicit Debt: TodoComment
naga/src/back/spv/block.rs6.0MixedExplicit Debt: TodoComment
naga/src/valid/expression.rs6.0MixedExplicit Debt: TodoComment
naga/src/back/msl/writer.rs6.0MixedExplicit Debt: TodoComment
naga/src/front/glsl/builtins.rs6.0MixedExplicit Debt: TodoComment
wgpu-hal/src/gles/queue.rs6.0MixedExplicit Debt: TodoComment
naga/src/back/hlsl/writer.rs6.0MixedExplicit Debt: TodoComment

How the grades work

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

Critical — 33

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

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

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

Could not be resolved — 12

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. 61 of 61 evaluated dimensions are computed purely by tools and static analysis (confidence 1.0); none rely on LLM judgement. Overall confidence is 0.9 — the weighted average across measured dimensions; it falls as more of the score leans on LLM-assisted judgement and rises when it's fully tool-backed.

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

What we checked — 61 dimensions across the health lenses
D1D2D3D4D5D6D9D12D13D14D15D16D17D19D20D26D28D29D30D34D35D36D37D43D44AX10AX3AX4AX8AX9M1M2M3M4P1P10P2P3P4P6PF1PF3X1X12X13X14X15X16X17X18X19X21X22X23X24X25X27X28X29X3X30

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

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

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

Tools & methods

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

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

Every finding is locatable in findings.md. Run 01a1767e-75b4-7405-9f37-681a813a3f8d.

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

Run transparency — what happened this run

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

  • D8 Code Coverage — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT READ here — but this repository measures it: a Codecov configuration (codecov.yml) and a coverage step in CI (`lcov --output`) shows that coverage is collected and tracked in your own CI. The built-in collector has no runner for this ecosystem (.rs), so the analyzer could not read the number — a gap in the analyzer's language coverage, not an unmeasured repo. Not scored. To have the real number read, produce a coverage report in a standard format (lcov — `cargo install cargo-llvm-cov`, then `cargo llvm-cov --lcov --output-path lcov.info`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures. You can widen what we reach: optional: produce a coverage report in a standard format (lcov — `cargo install cargo-llvm-cov`, then `cargo llvm-cov --lcov --output-path lcov.info`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures — then the real number is read on the next scan.
  • D11 Test Reliability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test source is present (.rs) and this repository declares a Cargo test suite (repository root, 100 test files), but it was not re-run: its build outgrew the 8 GB scratch ceiling (9.056 GB measured) and was stopped; its suite was not run. Not scored — this is a gap in the analyzer's language coverage, not a finding about this repository.
  • D15 Churn × Complexity Hotspots — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. A hotspot's complexity is meant to be the worst body its churn actually touched. For wgpu-types/src/features.rs, wgpu-core/src/lock/rank.rs that could not be established — the complexity reader for the file reports no body extents, or the history carries no per-line attribution — so the row quotes the file's worst body, which the counted changes may never have touched. The churn count is unaffected.
  • 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.
  • 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.
  • 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.
  • AX6 Interface segregation — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is computed over the public interfaces this run's compilations declare, and none was loaded, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • AXB1 Runtime evidence locked — no reproducible boot — 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. Subject: a web-server dependency ('express') — a service to boot even with no user interface. The Runtime Evidence tier boots an app only via docker-compose, an Aspire AppHost, a Dockerfile, an npm dev script, a web service's own toolchain entry point (cargo, go, dotnet, Python, Spring Boot), or an Android app's own Gradle wrapper (run on an emulator); an Apple or Flutter app needs a host it lacks. None applied, so no live runtime a11y/egress/header evidence was collected. You can widen what we reach: add a docker-compose.yml (or an Aspire AppHost) that brings the app up with its dependencies. Watchdog then boots it in an isolated sandbox and gathers real runtime evidence — you change nothing in your pipeline (no CI step, no SDK).
  • 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 Rust 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 Rust is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • M4 Documentation accuracy — measured, with a gap in what it reached — 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. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9). Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
  • P5 DR & Backup — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. No backup/snapshot/replication config, RTO/RPO or restore-procedure documentation was found — and no production persistence was detected either (no data-access packages, no data-store services, no database resources), so there is nothing in this repository whose loss a DR control would recover. If this system's data lives in a platform or ops repo we can't see, that's where the DR evidence belongs.
  • X5 Nullable reference types — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax and MSBuild project configuration, TypeScript source and its tsconfig files, Java source and its package and module declarations, PHP source and its PHPStan and Psalm configuration, Dart source and its pubspec language version, Ruby source and its Sorbet and Steep configuration, Scala source and its build's explicit-nulls, WartRemover and Scalafix settings, and Kotlin source only, and no C# was loaded, no TypeScript was found, and this repository's Rust is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.

Repo exclusion declarations: 3 pattern(s) declared (.gitattributes linguist-generated/vendored, .editorconfig generated_code) excluded 0 source file(s) from code-quality scoring. Declarations are the repo's own visible statement that a tree is machine-written or vendored — auditable in any diff, honored by GitHub the same way.

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.
  • D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
  • D13 Secret Scanning: Secret detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
  • D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
  • D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
  • D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
  • D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
  • D19 Documentation Quality: Documentation quality publishes two things only: a runnable or packaged unit with no example, and a multi-project root README that maps none of its parts. It does not judge clarity, and its other checks (overview, licence, boilerplate, structure, empty sections, XML-doc coverage) are withheld after adjudication: their candidates are counted in the card's gaps, not shown as rows. A false statement in a document is M4's; units are .NET projects only.
  • D20 ADR Quality: ADR quality 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.
  • D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
  • D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
  • D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
  • D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a Dockerfile (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
  • AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
  • AX9 CQS / query purity: Handlers are found by interface/name convention — a query handler using neither is not seen. Mutation is a resolved write/publish invocation (SaveChanges/repository/bus), so a write hidden behind a hand-rolled wrapper, reflection, or a string-keyed service locator resolves to a non-persistence type and isn't flagged; it detects that a query writes state, not whether the write is a legitimate read-side cache update. Clean means "no resolved write/publish in a query body", not a proof of CQS purity.
  • M4 Documentation accuracy: Onboarding quality is an LLM read of the docs/setup present — it cannot run the onboarding or measure how long a real new joiner takes; the verdict is sampled and advisory.
  • P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
  • P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.

Dimensions

D1 · Cyclomatic Complexity4.5 / 10Weak✓ Tool-verified

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

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

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

208 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was Writer::write_expr at 300. A further 69 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 AdapterShared::describe_texture_format at 104 — they are counted neither in the figure above nor in this dimension's score. 21 files carry no cyclomatic complexity row at all for this reason — every one of their over-threshold functions was excluded, so the exclusion is disclosed nowhere in the file itself: wgpu-hal/src/gles/conv.rs (AdapterShared::describe_texture_format at 104), deno_webgpu/texture.rs (TextureFormat::from at 95), naga/src/common/wgsl/to_wgsl.rs (MathFunction::try_to_wgsl at 78), wgpu-types/src/features.rs (Features::from_name at 78), wgpu-hal/src/auxil/dxgi/conv.rs (wgpu_hal::auxil::dxgi::conv::map_texture_format_failable at 67), and 16 more not listed here. 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.

Writer::write_expr (cyclomatic 300) · ×47naga/src/back/glsl/writer.rs:2425
Device::create_render_pipeline_or_error_inner (cyclomatic 119) · ×19wgpu-core/src/device/resource.rs:4731
naga::front::glsl::builtins::inject_standard_builtins (cyclomatic 177) · ×18naga/src/front/glsl/builtins.rs:462
Frontend::next_block (cyclomatic 291) · ×13naga/src/front/spv/next_block.rs:22
Validator::validate_expression (cyclomatic 211) · ×10naga/src/valid/expression.rs:382

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

What to do

  1. Bring the 3 bodies over 240 down to 240 or less in Cyclomatic Complexity — start with Writer::write_expr (cyclomatic 300), Frontend::next_block (cyclomatic 291), BlockContext::cache_expression_value (cyclomatic 249). — 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 4.5 to about 4.8/10, projected with the scoring formula itself and assuming each lands exactly at 240; a cleaner split scores higher.
  2. Enforce Cyclomatic Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D2 · Cognitive Complexity2.6 / 10Weak✓ Tool-verified

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

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

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

272 method(s) exceeded the cognitive complexity threshold of 15; the worst was Writer::write_functions at 543.

Writer::write_functions (cognitive 543) · ×60naga/src/back/msl/writer.rs:6871
Device::create_render_pipeline_or_error_inner (cognitive 232) · ×26wgpu-core/src/device/resource.rs:4731
naga::front::glsl::builtins::inject_standard_builtins (cognitive 135) · ×21naga/src/front/glsl/builtins.rs:462
Frontend::next_block (cognitive 350) · ×18naga/src/front/spv/next_block.rs:22
CommandEncoder::begin_render_pass_inner::fill_arc_desc (cognitive 74) · ×15wgpu-core/src/command/render.rs:1887

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

What to do

  1. Bring the 5 bodies over 240 down to 240 or less in Cognitive Complexity — start with Writer::write_functions (cognitive 543), Writer::write_expr (cognitive 391), Frontend::next_block (cognitive 350). — 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 5 together lifts Cognitive Complexity from 2.6 to about 3.8/10, projected with the scoring formula itself and assuming each lands exactly at 240; a cleaner split scores higher.
  2. Enforce Cognitive Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D3 · God Classes7.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.

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

314 god class(es) detected.

MethodTooLong: Frontend.next_block · ×152naga/src/front/spv/next_block.rs:22
FileTooLong: msl/writer.rs · ×85naga/src/back/msl/writer.rs
FunctionTooLong: naga::front::glsl::builtins::inject_standard_builtins · ×28naga/src/front/glsl/builtins.rs:462
ClassTooLong: Device · ×23wgpu-core/src/device/resource.rs:235
TooManyMethods: Global · ×22wgpu-core-remote/src/global/mod.rs:40

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

What to do

  1. Resolve the 152 MethodTooLong finding(s) in God Classes — start with writer.rs (17), device.rs (17), mod.rs (16). — One of this dimension's main actionable groups (152 warning-level).
  2. Resolve the 85 FileTooLong finding(s) in God Classes — start with mod.rs (14), device.rs (6), writer.rs (5). — One of this dimension's main actionable groups (85 warning-level).
  3. Resolve the 28 FunctionTooLong finding(s) in God Classes — start with builtins.rs (4), pipeline_constants.rs (3), render.rs (2). — One of this dimension's main actionable groups (28 warning-level).
  4. Enforce God Classes in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D4 · Code Duplication9.3 / 10Stronggated by 392 serious findings✓ Tool-verified

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

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

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

387 duplicated block group(s) detected. A further 5 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted.

Duplicated block (7 lines × 2) · ×27deno_webgpu/lib.rs:395
Duplicated block (11 lines × 2) · ×26naga/src/back/glsl/writer.rs:3179
Duplicated block (6 lines × 2) · ×25naga/src/back/glsl/writer.rs:3532
Duplicated block (10 lines × 2) · ×24naga/src/back/glsl/writer.rs:1672
Duplicated block (8 lines × 2) · ×23naga/src/back/dot/mod.rs:221

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

What to do

  1. Resolve the 27 Duplicated block (7 lines × 2) finding(s) in Code Duplication — start with writer.rs (8), mod.rs (5), dispatch.rs (2). — One of this dimension's main actionable groups (27 warning-level).
  2. Resolve the 26 Duplicated block (11 lines × 2) finding(s) in Code Duplication — start with writer.rs (6), dispatch.rs (4), interface.rs (2). — One of this dimension's main actionable groups (26 warning-level).
  3. Resolve the 25 Duplicated block (6 lines × 2) finding(s) in Code Duplication — start with writer.rs (10), mod.rs (5), device.rs (2). — One of this dimension's main actionable groups (25 warning-level).
  4. Enforce Code Duplication in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.

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

D5 · Coupling8.3 / 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.

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

24 production modules (Cargo), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations; 5 module(s) off the main sequence, with abstractness counted on 18 of the 24 (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).

Off the main sequence: hlsl-snapshots · ×5

What to do

  1. Resolve the 5 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (5 warning-level).
  2. 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.

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

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

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

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

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

4 of 422 classes have LCOM4 above 3.

Low cohesion: Device (LCOM4 9) · ×4wgpu-hal/src/dx12/mod.rs:653

What to do

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

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

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

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

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

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

722 test methods: 333 unit, 389 integration, 0 BDD, 0 e2e. The Rust suite contributes 722 `#[test]` function(s) across 100 file(s) declaring at least one; its unit/integration split is Cargo's own — 33 of those file(s) are integration-test targets under a crate's tests/ directory, and the rest are #[test] functions compiled into the crate they test.

✓ On the Gold path — maintain.

Detailed fixes: d9_recommendation.md.

D12 · Dependency Hygiene9.8 9.8 / 10Exemplary✓ Tool-verified

What it measures: Whether dependencies are current, secure, and not bloated.

Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (saturating for vulnerabilities, capped-linear for deprecation/outdated) per KLoC. Exhaustive, deterministic.

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

3 outdated, 0 yanked direct Cargo dependencies. 113 of 114 direct crates were graded against crates.io (0 not published there, 1 not resolved by a committed REDACTED). Only DIRECT edges are graded: a transitive crate cannot be moved past what its parent's requirement admits, so reporting one would be advice its owner cannot take. A newer release is reported only where this repository's OWN requirement already admits it, so the remedy is `cargo update` and never a manifest edit — which means a release outside the declared range is deliberately NOT charged, because a written-down constraint is a decision rather than a defect. Note that a bare requirement is a CARET, and for a 0.x crate its ceiling is the minor. Whether any crate is UNMAINTAINED is not graded — crates.io publishes no maintenance status, and release age does not stand in for one. Known CVEs in this dependency graph are D30's question, read from REDACTED there.

Outdated: deno_error · ×3

✓ On the Gold path — maintain.

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

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

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

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

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

Secret scan ran and found no leaked secrets.

✓ On the Gold path — maintain.

Detailed fixes: d13_recommendation.md.

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

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

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

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

0 of 537 shipped crate(s) use a banned license. Licences were resolved from crates.io over the crates a consumer compiles — this repository's REDACTED closed over its manifests' `[dependencies]` and `[build-dependencies]`. Crates it asks for ONLY under `[dev-dependencies]` are excluded: they are not compiled by anything that depends on this repository. This repository publishes itself under MIT OR Apache-2.0, which is its own choice and is not judged here.

✓ On the Gold path — maintain.

Detailed fixes: d14_recommendation.md.

D15 · Churn × Complexity Hotspots9.0 / 10Strong✓ Tool-verified

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

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

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

Top hotspots: wgpu-core/src/device/resource.rs (59×119=7021); wgpu-hal/src/metal/adapter.rs (16×133=2128); wgpu/src/backend/wgpu_core.rs (83×19=1577) Repeated repair below the complexity floor: wgpu-core/src/command/memory_init.rs (4 of 4 changes were fixes)

Hotspot: wgpu-core/src/device/resource.rs · ×37wgpu-core/src/device/resource.rs:4731
Repeated repair: wgpu-core/src/command/memory_init.rswgpu-core/src/command/memory_init.rs:350

What to do

  1. Resolve the 37 Hotspot finding(s) in Churn × Complexity Hotspots — start with writer.rs (5), adapter.rs (4), resource.rs (2). — One of this dimension's main actionable groups (37 warning-level).
  2. Resolve the 1 Repeated repair finding(s) in Churn × Complexity Hotspots — start with memory_init.rs. — One of this dimension's main actionable groups (1 warning-level).

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

D16 · Bus Factor9.5 / 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.

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

20 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is naga/src/back/msl/ray.rs. Counted over 372 of the 458 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Off-boarding risk: anonymized user #1
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.

D17 · Explicit Debt9.8 / 10Stronggated by 266 serious findings✓ Tool-verified

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

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

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

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

TodoComment · ×242wgpu-types/src/adapter.rs:142
HackComment · ×14wgpu-hal/src/gles/mod.rs:521
FixmeComment · ×7wgpu-types/src/write_only.rs:40
XxxComment · ×2wgpu-types/src/counters.rs:185
TodoComment repeated across 17 filesdeno_webgpu/bind_group.rs:56

What to do

  1. Resolve the 242 TodoComment finding(s) in Explicit Debt — start with mod.rs (33), writer.rs (25), adapter.rs (20). — One of this dimension's main actionable groups (242 warning-level).
  2. Resolve the 14 HackComment finding(s) in Explicit Debt — start with next_block.rs (4), mod.rs (3), block.rs (2). — One of this dimension's main actionable groups (14 warning-level).
  3. Resolve the 7 FixmeComment finding(s) in Explicit Debt — start with write_only.rs (4), buffer_mapping.rs (2), lib.rs. — One of this dimension's main actionable groups (7 warning-level).
  4. Enforce Explicit Debt in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D19 · Documentation Quality10.0 / 10Exemplary○ Nothing flagged

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

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d19_recommendation.md.

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

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

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

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

No architecture decision records were found.

No ADRs found

What to do

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

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

D26 · Project Cohesion5.8 / 10Adequate✓ Tool-verified

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

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

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

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

Projects may be oversized for their cohesion

What to do

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

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

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

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

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d28_recommendation.md.

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

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

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

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

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

21 finding(s): 0 critical, 21 high, 0 medium, 0 low. semgrep hit a parse error in 5 file(s) — `naga/src/front/wgsl/parse/number.rs` (line 104), `naga/src/proc/constant_evaluator.rs` (line 35), `wgpu-core/src/command/mod.rs` (line 1340, line 1414, line 1416, …), `wgpu-core/src/device/resource.rs` (line 367, lines 368–369), `wgpu-types/src/write_only.rs` (line 131) — so no absence of findings in the named regions is evidence of anything; rows reported elsewhere in those files are real. Fix the syntax error (or exclude the file deliberately) and re-scan to cover them. Separately, one or more rules could not re-parse an embedded snippet in 7 file(s) (e.g. a workflow `run:` block read as shell). Those files WERE scanned and their other rows are unaffected; only those rules' view of those snippets is missing.

REDACTED
REDACTED
REDACTED

What to do

  1. Resolve the 16 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (10), REDACTED (3), REDACTED (2). — One of this dimension's main actionable groups (16 issue-level).
  2. Resolve the 4 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (4). — One of this dimension's main actionable groups (4 issue-level).
  3. Resolve the 1 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).

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

D30 · Dependency Vulnerabilities8.3 / 10Strong✓ Tool-verified

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

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

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

9 finding(s): 0 critical, 0 high, 9 medium, 0 low.

REDACTED

What to do

  1. Resolve the 9 Medium advisory (unmaintained) finding(s) in Dependency Vulnerabilities — start with REDACTED (9). — One of this dimension's main actionable groups (9 warning-level).

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

D34 · Knowledge Freshness9.4 / 10Adequategated by 4 critical findings✓ Tool-verified

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

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

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

23 of 372 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is naga/src/front/spv/image.rs. Counted over 372 of the 458 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Orphaned knowledge · ×4naga/src/front/spv/image.rs:1
Orphaned file · ×19naga/src/front/glsl/parser/types.rs:1
Further orphaned files (smaller)

What to do

  1. Resolve the 4 Orphaned knowledge finding(s) in Knowledge Freshness — start with image.rs, storage.rs, declarations.rs. — One of this dimension's main actionable groups (4 issue-level).
  2. Resolve the 19 Orphaned file finding(s) in Knowledge Freshness — start with types.rs, continue_forward.rs, ast.rs. — One of this dimension's main actionable groups (19 recommendation-level).
  3. Resolve the 1 Further orphaned files (smaller) finding(s) in Knowledge Freshness. — One of this dimension's main actionable groups (1 recommendation-level).

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

D35 · Change Coupling9.7 / 10Adequategated by 8 critical findings✓ Tool-verified

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

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

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

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

Strongest change-coupling: adapter.rs↔human.rs 68%; adapter.rs↔human.rs 68%; buffer.rs↔texture.rs 68%

Boundary-crossing change coupling: adapter.rs ↔ human.rs · ×8wgpu-hal/src/dx12/adapter.rs:1
Change coupling: buffer.rs ↔ texture.rs · ×2wgpu-core/src/track/buffer.rs:1
Change coupling clique: dispatch.rs, draw.rs, mod.rswgpu-core/src/indirect_validation/dispatch.rs

What to do

  1. Resolve the 8 Boundary-crossing change coupling finding(s) in Change Coupling — start with adapter.rs (4), conv.rs (2), human.rs. — One of this dimension's main actionable groups (8 issue-level).
  2. Resolve the 2 Change coupling finding(s) in Change Coupling — start with buffer.rs (2). — One of this dimension's main actionable groups (2 warning-level).
  3. Resolve the 1 Change coupling clique finding(s) in Change Coupling — start with dispatch.rs. — One of this dimension's main actionable groups (1 warning-level).

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

D36 · Supply-chain Provenance & Signing2.5 / 10Weak✓ Tool-verified

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

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

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

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

REDACTED
REDACTED
REDACTED
REDACTED

What to do

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

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

D37 · Vulnerability-disclosure Policy10.0 / 10Exemplary✓ Tool-verified

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.

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

A vulnerability-disclosure policy (SECURITY.md) is published with a reporting contact.

✓ On the Gold path — maintain.

Detailed fixes: d37_recommendation.md.

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

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

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d43_recommendation.md.

D44 · Platform End-of-Life6.0 / 10Adequate✓ Tool-verified

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

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

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

1 end-of-life runtime(s) and 0 end-of-life framework(s), read from 2 platform declaration(s) and 0 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.

End-of-life runtime: Rust 1.96rust-toolchain.toml:1

What to do

  1. Resolve the 1 End-of-life runtime finding(s) in Platform End-of-Life — start with rust-toolchain.toml. — One of this dimension's main actionable groups (1 warning-level).

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

Frontend & cross-cutting dimensions

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

AX10 · Code composition9.4 / 10Exemplary✓ Tool-verified

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

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

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

What to do

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

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

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

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

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

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

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.

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

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

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

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

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

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

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

What to do

  • Add an 'Architecture' / 'How it works' section to the root README — the high-level shape.
  • Add a README to the 21 of 34 project(s) that lack one — worth up to 1.2 pts.
M2 · Architecture documentation5.0 / 10Adequate✓ Tool-verified

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

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

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

What to do

  • Record 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.
M3 · Folder & project structure10.0 / 10Exemplary✓ Tool-verified

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

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

M4 · Documentation accuracy4.0 / 10Weak✓ Tool-verified

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

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

  • wgpu-hal/README.md links to `vulkan/struct.Api.html`, but `wgpu-hal/vulkan/struct.Api.html` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — wgpu-hal/README.md:74
  • wgpu-hal/README.md links to `metal/struct.Api.html`, but `wgpu-hal/metal/struct.Api.html` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — wgpu-hal/README.md:75
  • wgpu-hal/README.md links to `gles/index.html`, but `wgpu-hal/gles/index.html` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — wgpu-hal/README.md:102

What to do

  • Reconcile the README with reality: wgpu-hal/README.md links to `vulkan/struct.Api.html`, but `wgpu-hal/vulkan/struct.Api.html` does not exist; wgpu-hal/README.md links to `metal/struct.Api.html`, but `wgpu-hal/metal/struct.Api.html` does not exist; wgpu-hal/README.md links to `gles/index.html`, but `wgpu-hal/gles/index.html` does not exist.
P1 · CI/CD gates10.0 / 10Exemplary○ Nothing flagged

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

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

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

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

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

P2 · Observability6.5 / 10Adequate✓ Tool-verified

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

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

  • Only 11/13 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `lock-analyzer`, `naga/fuzz`.

What to do

  • Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
P3 · Security & performance tooling9.0 / 10Exemplary✓ Tool-verified

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

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

What to do

  • Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
P4 · Deployment & Rollback5.0 / 10Adequate✓ Tool-verified

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

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

What to do

  • Nothing pauses a release for a human: publish as a draft release (or gate the release job on a protected tag/manual dispatch) so a bad build can be stopped before users can download it.
P6 · Release Hygiene10.0 / 10Exemplary✓ Tool-verified

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

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

PF1 · Benchmark discipline7.5 / 10Strong✓ Tool-verified

Readiness · Performance — Whether the code protects its performance with benchmarks — a benchmark suite, allocation/memory measurement, and (ideally) a CI gate. Presence is credited as a bonus, never a deduction.

Method: Repo + source scan: BenchmarkDotNet referenced (csproj/source), [Benchmark]/[MemoryDiagnoser] attribute counts, and a benchmark step in CI; off .NET, the same ladder over Go testing.B, Rust criterion/#[bench]/divan, JMH/kotlinx-benchmark, pytest-benchmark/asv/pyperf, tinybench/mitata/vitest bench/benchmark.js and Swift package-benchmark — scored as a bonus ladder (absence is neutral, never a deduction). Deterministic, presence detection.

PF3 · Async & latency hygiene10.0 / 10Exemplary✓ Tool-verified

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

Method: Production-source scan: sync-over-async blocking counted everywhere — .Wait()/.GetAwaiter().GetResult() in .NET; off .NET, read from the language model, a blocking call inside an async function (Python, TS/JS, Rust, Kotlin, 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.

X1 · Async correctness10.0 / 10Exemplary○ Nothing flagged

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.

X12 · Unreachable branch10.0 / 10Exemplary○ Nothing flagged

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.

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.

X14 · Bypassable address classification10.0 / 10Exemplary○ Nothing flagged

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.

X15 · Unvalidated length from an untrusted reader10.0 / 10Exemplary○ Nothing flagged

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.

X16 · Unfloored truncation loop10.0 / 10Exemplary○ Nothing flagged

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.

X17 · Uncapped recursion over a caller-supplied document10.0 / 10Exemplary○ Nothing flagged

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.

X18 · Disposal-pattern correctness10.0 / 10Exemplary○ Nothing flagged

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.

X19 · Unrestored process-global state10.0 / 10Exemplary○ Nothing flagged

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.

X21 · Side-effecting pattern guard10.0 / 10Exemplary○ Nothing flagged

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.

X22 · Contradicted release guard10.0 / 10Exemplary○ Nothing flagged

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.

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

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

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

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.

X25 · Inert configuration knob10.0 / 10Exemplary○ Nothing flagged

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.

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

Other · Code Health — Whether a `for` loop leaves the `RefCell` it is walking alone — safe Rust rejects a body that changes the collection its loop borrows at compile time, except through interior mutability: a `RefCell` borrowed in the loop's header stays borrowed until the loop ends, so a `borrow_mut()` of it inside the body panics with `already borrowed: BorrowMutError` and the remaining elements are never seen.

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

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

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

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

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.

X3 · Exception handling10.0 / 10Exemplary○ Nothing flagged

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.

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.

Reference — by lens

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

LensScoreRatingImpact
Code Health85%Adequate — gated by D2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture93%ExemplaryStrongest area.
Maturity64%AdequateLargest drag on the score — prioritise here.
Readiness78%StrongSolid.
Security67%Adequate — gated by D29, D36Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Performance86%StrongSolid.
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.

  • P12 CI test-gate honesty — 1 observation(s) recorded · Reported, not scored — this card publishes what the CI gate does with the test inventory rather than grading it. The findings above are its output.
  • X10 Duplicated predicate — 7 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X7 Silent fallback defaults — 3 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X9 Subsumed condition operand — 1 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 1 control(s) we could not find positive evidence for

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

  • P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 55 check(s) not relevant to this codebase

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

  • AC1 Text alternatives — No web markup found — accessibility is not applicable to this repository.
  • AC2 Forms & labels — No web markup found — accessibility is not applicable to this repository.
  • AC3 Page structure — No web markup found — accessibility is not applicable to this repository.
  • AC4 Keyboard semantics — No web markup found — accessibility is not applicable to this repository.
  • AC5 ARIA correctness — No web markup found — accessibility is not applicable to this repository.
  • AC6 Visual & motion safety — No web markup found — accessibility is not applicable to this repository.
  • AC7 A11y enforcement — No web markup found — accessibility is not applicable to this repository.
  • AX1 Captive dependencies — Not applicable: this repository's JavaScript imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's; Rust with no dependency-injection crate has no container to hand one lifetime's instance to another — every value is owned by the code that builds it, and the borrow checker rejects a longer-lived value keeping a borrow of a shorter-lived one.
  • AX2 Stateful singletons — Not applicable: Rust's compiler refuses unsynchronised shared mutation — a value shared across threads must be Sync — so the race this check looks for cannot be written. TypeScript/JavaScript runs each process's requests on one event loop, so no two requests write a shared object at the same instant (interleaving across an await is a different defect).
  • AX5 Architecture & structure — not assessed — architecture style/structure is computed from a project graph (projects, types, module namespaces) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX6 Interface segregation — not assessed — interface segregation is computed over a type surface that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX7 Slice cohesion — not applicable — not a vertical-slice architecture
  • AXB1 Runtime evidence locked — no reproducible boot — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • C1 Data Protection — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no data at rest for these controls to protect.
  • C2 Access Controls — No access-control surface detected in the analyzed source — this repository starts no server another machine can reach (no actix-web HttpServer, axum::serve, Rocket launch, warp::serve, poem or salvo Server, tonic Server::builder, hyper or tiny_http server outside examples and tests, none bound beyond loopback). Access control is therefore N/A here — a crate is authorized by the application that serves it, not by itself. If this codebase grows request handlers, the dimension reactivates and a default-deny posture is expected then.
  • C3 Audit Trail — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no sensitive data whose changes an audit trail would record. If it does (through a store configured outside this repository, for instance), the trail belongs to wherever that data is stored.
  • C4 Data Retention — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no personal data whose lifetime a retention limit would bound.
  • C5 Data-Subject Rights — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no personal data for a data subject to erase, export or consent over.
  • D10 Test Quality — ~67897 lines of test source are present (.rs) but no test cases reached the test census for this repository — no test root we could resolve declared them, or the files we read declare no cases in a test framework we recognise — so skipped/assertion-free tests couldn't be counted. Not scored — this is a gap in the analyzer, not a finding about this repository.
  • D11 Test Reliability — Test reliability not included — the .rs suite was found but not re-run
  • 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; JavaScript, Rust, html not measured.
  • D22 Internal API Consistency — API consistency is measured on C# only; the exposed Rust 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. 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 .rs, 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 (.rs), 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.
  • D31 IaC & Container Security — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
  • D32 Data Compliance (PII/GDPR) — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that.
  • D39 IL Efficiency — D39 measures the IL emitted by a .NET build; this repository has no .NET solution or project files, so the dimension does not apply.
  • D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
  • D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
  • D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
  • D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
  • D8 Code Coverage — Coverage not included — suite not readable by the collector
  • DM1 Domain Modelling — not scored — this repository shows only 1 of the 3 signals this lens looks for (167 value object(s))
  • ED2 Event/command shape — not scored — deciding whether a command has more than one competing handler requires resolving the call graph, and a call made through an inferred or generic receiver has no resolvable owner in the source. Reported as guidance rather than measured
  • ED5 Idempotency — 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
  • P7 Outbound HTTP resilience — not applicable — no HTTP server, API framework or worker entry point was found in the JavaScript/TypeScript, Rust source, so there is no service whose uptime a failing dependency could take down
  • P8 Schema migrations — no ORM, schema-migration tool or schema auto-create was found in this repository's dependency manifests or source, so there is no database schema for this check to judge
  • P9 Domain vs controller coverage — no coverage report found on disk — produce a coverage report in a standard format (lcov — `cargo install cargo-llvm-cov`, then `cargo llvm-cov --lcov --output-path lcov.info`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures, or wire coverage collection into CI, to enable this cross-layer check
  • PF2 Allocation hygiene — Not applicable: Rust spells out every heap allocation and makes borrowed slices (&[T], &str) its ordinary parameter types, so the allocation-aware style this card rewards elsewhere is the language's baseline rather than a rung to climb.
  • S1 Web-Security Posture — No web surface: 488 Rust file(s) were read for weak hashes and ciphers, key material fixed in the source, disabled TLS certificate validation and obsolete TLS versions, and none was found. This repository serves no HTTP of its own — no HTTP-server crate (actix-web, axum, Rocket, warp, poem, tide, salvo, tonic, a hyper server, …) among its Cargo manifests' run-time dependencies, and no server started in its production source — so HTTPS enforcement, HSTS, cookie flags and input validation are N/A here, as they are for a C# library or worker. If this codebase starts serving HTTP, the dimension reactivates automatically.
  • SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • X2 Cancellation propagation — no C# was loaded; this repository's Rust was read, and no request in it can be cancelled by a caller — a Rust request takes no token: a future is cancelled by dropping it, from outside the call (select!, a timeout, an aborted task), and reqwest, hyper and tonic take none
  • X20 Mistyped argument guard — This check asks whether an argument guard reports an EMPTY value as a NULL one, which needs a language that throws a null-specific argument exception — .NET's ArgumentNullException, the JVM's NullPointerException, Dart's ArgumentError.notNull. This repository contains none of those languages: the ones it is written in have a single exception for a bad argument, so there is no pair of exceptions to confuse and nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X26 Unsynchronised callback handoff — Not applicable: this check looks for a collection written by a callback on one thread while the body waiting on it touches it on another, and in this repository's languages no collection is reachable from two threads at once. Rust's compiler refuses the unsynchronised version: a collection shared between a callback's thread and the waiting body must be `Sync`, which a `Vec`, `VecDeque` or `HashMap` is only behind a `Mutex`/`RwLock`, so the race this check looks for cannot be written in safe Rust. TypeScript/JavaScript runs every callback on the one thread that owns its objects: a callback runs only when the body waiting on it has yielded, never alongside it, and a worker thread receives a COPY of what it is sent. A SharedArrayBuffer carries raw bytes, never an Array, Map or Set, so no collection is reachable from two threads at once. Not a gap in the analyzer and not a finding about your code.
  • X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X4 Structured logging — This check asks whether log calls keep a message's values apart from its text, which needs a logger that can carry them as fields. This repository's Rust was read, and it logs through none: the `log` crate's macros take one finished message (as log4net does in C#; its `kv` values are an opt-in its backends mostly drop), `println!`/`eprintln!` are not loggers, or it makes no log call outside its tests and examples at all. Calls through `tracing` (`tracing::info!`, or `info!` imported from it) would be judged.
  • X5 Nullable reference types — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X6 Hand-rolled structured-format parsing — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.

Appendix A — Findings (grouped)

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

Critical — 33 finding(s)
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D35 · Change Coupling · Boundary-crossing change coupling · ×8
  • Boundary-crossing change coupling: adapter.rs ↔ human.rs wgpu-hal/src/dx12/adapter.rs:1 — `wgpu-hal/src/dx12/adapter.rs` (context wgpu-hal) and `wgpu-info/src/human.rs` (context wgpu-info) sit in DIFFERENT parts of the tree yet change together 68% of the time (15 of the 22 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 15 shared commits counted here, the most recent 3 are `9920c99c` feat(core): add `Limits::max_storage_{buffers,textures}_in_{vertex,fr…; `995ee7b3` add `Limits::max_buffers_and_acceleration_structures_per_shader_stage`; `c841633b` Bring transient attachment in line with webgpu spec (#9568) — run `git show` on any of them.
  • Boundary-crossing change coupling: adapter.rs ↔ human.rs wgpu-hal/src/vulkan/adapter.rs:1 — `wgpu-hal/src/vulkan/adapter.rs` (context wgpu-hal) and `wgpu-info/src/human.rs` (context wgpu-info) sit in DIFFERENT parts of the tree yet change together 68% of the time (15 of the 22 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 15 shared commits counted here, the most recent 3 are `9920c99c` feat(core): add `Limits::max_storage_{buffers,textures}_in_{vertex,fr…; `995ee7b3` add `Limits::max_buffers_and_acceleration_structures_per_shader_stage`; `c841633b` Bring transient attachment in line with webgpu spec (#9568) — run `git show` on any of them.
  • Boundary-crossing change coupling: conv.rs ↔ lib.rs wgpu-core/src/conv.rs:1 — `wgpu-core/src/conv.rs` (context wgpu-core) and `wgpu-types/src/lib.rs` (context wgpu-types) sit in DIFFERENT parts of the tree yet change together 67% of the time (40 of the 60 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 40 shared commits counted here, the most recent 3 are `e7fcb948` Make multi-planar textures renderable (#8307); `f0209e3d` Add support for transient textures on Vulkan and Metal (#8247); `1c43ac2c` Additional validation of buffer-texture copies (#7948) — run `git show` on any of them.
  • Boundary-crossing change coupling: adapter.rs ↔ human.rs wgpu-hal/src/gles/adapter.rs:1 — `wgpu-hal/src/gles/adapter.rs` (context wgpu-hal) and `wgpu-info/src/human.rs` (context wgpu-info) sit in DIFFERENT parts of the tree yet change together 64% of the time (14 of the 22 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 14 shared commits counted here, the most recent 3 are `9920c99c` feat(core): add `Limits::max_storage_{buffers,textures}_in_{vertex,fr…; `995ee7b3` add `Limits::max_buffers_and_acceleration_structures_per_shader_stage`; `4bbed407` add `max_bind_groups_plus_vertex_buffers` limit — run `git show` on any of them.
  • Boundary-crossing change coupling: human.rs ↔ webgpu.rs wgpu-info/src/human.rs:1 — `wgpu-info/src/human.rs` (context wgpu-info) and `wgpu/src/backend/webgpu.rs` (context wgpu) sit in DIFFERENT parts of the tree yet change together 64% of the time (14 of the 22 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 14 shared commits counted here, the most recent 3 are `9920c99c` feat(core): add `Limits::max_storage_{buffers,textures}_in_{vertex,fr…; `995ee7b3` add `Limits::max_buffers_and_acceleration_structures_per_shader_stage`; `c841633b` Bring transient attachment in line with webgpu spec (#9568) — run `git show` on any of them.
  • Boundary-crossing change coupling: adapter.rs ↔ human.rs wgpu-hal/src/metal/adapter.rs:1 — `wgpu-hal/src/metal/adapter.rs` (context wgpu-hal) and `wgpu-info/src/human.rs` (context wgpu-info) sit in DIFFERENT parts of the tree yet change together 55% of the time (12 of the 22 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 12 shared commits counted here, the most recent 3 are `9920c99c` feat(core): add `Limits::max_storage_{buffers,textures}_in_{vertex,fr…; `995ee7b3` add `Limits::max_buffers_and_acceleration_structures_per_shader_stage`; `4bbed407` add `max_bind_groups_plus_vertex_buffers` limit — run `git show` on any of them.
  • Boundary-crossing change coupling: webidl.rs ↔ adapter.rs deno_webgpu/webidl.rs:1 — `deno_webgpu/webidl.rs` (context deno_webgpu) and `wgpu-hal/src/metal/adapter.rs` (context wgpu-hal) sit in DIFFERENT parts of the tree yet change together 53% of the time (8 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) — 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 8 shared commits counted here, the most recent 3 are `ca3239e6` chore!: Move `PRIMITIVE_INDEX` feature into the WebGPU group (#9101); `3dfa9af0` Enable `FLOAT32_BLENDABLE` on Metal, in Deno, and separate from filte…; `8f50bb9d` Make passthrough shaders non-experimental (#9054) — run `git show` on any of them.
  • Boundary-crossing change coupling: conv.rs ↔ lib.rs wgpu-hal/src/auxil/dxgi/conv.rs:1 — `wgpu-hal/src/auxil/dxgi/conv.rs` (context wgpu-hal) and `wgpu-types/src/lib.rs` (context wgpu-types) sit in DIFFERENT parts of the tree yet change together 50% of the time (11 of the 22 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 11 shared commits counted here, the most recent 3 are `0b6571a6` Align Storage Access enums to spec (#6642); `07684d36` Rename Rg11b10UFloat to Rg11b10Ufloat (#6226); `c6a3d927` `Rg11b10Float` -> `Rg11b10UFloat` and deduplicate entries in `TEXTURE… — run `git show` on any of them.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D34 · Knowledge Freshness · Orphaned knowledge · ×4
  • Orphaned knowledge naga/src/front/spv/image.rs: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 naga/src/back/hlsl/storage.rs: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 naga/src/front/glsl/parser/declarations.rs: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 naga/src/front/glsl/parser/expressions.rs: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.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
Serious — 1513 finding(s)
D17 · Explicit Debt · TodoComment · ×242
  • TodoComment wgpu-types/src/adapter.rs:142 — //TODO: convert `vendor` and `device` to `u32` — 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 wgpu-types/src/counters.rs:139 — // TODO #[cfg(features=)] — 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 wgpu-types/src/limits.rs:1334 — // TODO: Fill out the differences between shader models more completely — 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 wgpu-types/src/origin_extent.rs:171 — /// TODO(<https://github.com/gfx-rs/wgpu/issues/8491>): It also does not
  • TodoComment wgpu-types/src/write_only.rs:1033 — // TODO: have more consistent errors so this assertion can be stronger — 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 wgpu-types/src/texture/format.rs:683 — /// TODO(<https://github.com/gfx-rs/wgpu/issues/8491>): Remove this note.
  • TodoComment wgpu-hal/src/lib.rs:222 — // 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 wgpu-hal/src/lib.rs:260 — // TODO(https://github.com/gfx-rs/wgpu/issues/7120): this should have a cfg
  • TodoComment wgpu-hal/src/lib.rs:466 — // TODO: the allocator's configuration should take hardware capability into — 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 wgpu-hal/src/lib.rs:486 — // TODO: https://github.com/gfx-rs/wgpu/issues/8625
  • TodoComment wgpu-hal/src/lib.rs:613 — // TODO(https://github.com/rust-lang/rust/issues/18598): avoid indirection via Box once arbitrary types support unsized coercion
  • TodoComment wgpu-hal/src/vulkan/adapter.rs:1719 — // TODO: programmatically determine this, if possible. It's unclear whether we can — 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 wgpu-hal/src/vulkan/adapter.rs:1926 — // TODO: Use `vk::API_VERSION_1_4` after `ash` is updated. — 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 wgpu-hal/src/vulkan/adapter.rs:2062 — // TODO(https://github.com/gfx-rs/wgpu/issues/9742): enable on
  • TodoComment wgpu-hal/src/vulkan/adapter.rs:2361 — // TODO: only enable for particular devices — 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 wgpu-hal/src/vulkan/adapter.rs:2494 — //TODO: make 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 wgpu-hal/src/vulkan/adapter.rs:2546 — //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 wgpu-hal/src/gles/conv.rs:33 — //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 wgpu-hal/src/gles/conv.rs:35 — //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 naga/src/back/glsl/writer.rs:2555 — //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 wgpu-hal/src/vulkan/adapter.rs:2895 — // TODO: expose this more generally — 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 wgpu-hal/src/vulkan/adapter.rs:2944 — // TODO: support bounds checks on binding arrays — 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 wgpu-hal/src/metal/device.rs:221 — // TODO: support bounds checks on binding arrays — 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 wgpu-hal/src/vulkan/adapter.rs:3475 — // TODO: check for (`VK_KHR_get_physical_device_properties2` or VK1.1) and (`VK_KHR_format_feature_flags2` or VK1.3). — 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 wgpu-hal/src/vulkan/command.rs:621 — // TODO: Code is so large that rustfmt refuses to treat 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.
  • + 217 more in this group — see findings.md.
D3 · God Classes · MethodTooLong · ×152
  • MethodTooLong: Frontend.next_block naga/src/front/spv/next_block.rs:22 — MethodTooLong — next_block runs 2229 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 2129 over it, 22.29× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Queue.process wgpu-hal/src/gles/queue.rs:192 — MethodTooLong — process runs 1310 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 1210 over it, 13.10× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Error.as_parse_error naga/src/front/wgsl/error.rs:678 — MethodTooLong — as_parse_error runs 813 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 713 over it, 8.13× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Validator.validate_expression naga/src/valid/expression.rs:382 — MethodTooLong — validate_expression runs 741 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 641 over it, 7.41× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Validator.validate_block_impl naga/src/valid/function.rs:789 — MethodTooLong — validate_block_impl runs 734 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 634 over it, 7.34× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Writer.write_expr naga/src/back/hlsl/writer.rs:3735 — MethodTooLong — write_expr runs 662 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 562 over it, 6.62× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Lowerer.call_builtin naga/src/front/wgsl/lower/mod.rs:3110 — MethodTooLong — call_builtin runs 651 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 551 over it, 6.51× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Adapter.expose wgpu-hal/src/dx12/adapter.rs:65 — MethodTooLong — expose runs 649 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 549 over it, 6.49× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Writer.write_stmt naga/src/back/hlsl/writer.rs:2187 — MethodTooLong — write_stmt runs 645 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 545 over it, 6.45× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Device.create_render_pipeline_or_error_inner wgpu-core/src/device/resource.rs:4731 — MethodTooLong — create_render_pipeline_or_error_inner runs 607 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 507 over it, 6.07× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Adapter.expose wgpu-hal/src/gles/adapter.rs:195 — MethodTooLong — expose runs 568 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 468 over it, 5.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.
  • MethodTooLong: Context.lower_inner naga/src/front/glsl/context.rs:544 — MethodTooLong — lower_inner runs 544 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 444 over it, 5.44× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: VaryingContext.validate_impl naga/src/valid/interface.rs:234 — MethodTooLong — validate_impl runs 446 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 346 over it, 4.46× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Writer.write_math_expression naga/src/back/hlsl/writer.rs:3067 — MethodTooLong — write_math_expression runs 441 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 341 over it, 4.41× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ResolveContext.resolve naga/src/proc/typifier.rs:265 — MethodTooLong — resolve runs 419 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 319 over it, 4.19× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ConstantEvaluator.math naga/src/proc/constant_evaluator.rs:1489 — MethodTooLong — math runs 418 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 318 over it, 4.18× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Device.create_pipeline_layout wgpu-hal/src/dx12/device.rs:970 — MethodTooLong — create_pipeline_layout runs 397 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 297 over it, 3.97× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Validator.validate_type naga/src/valid/type.rs:383 — MethodTooLong — validate_type runs 392 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 292 over it, 3.92× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Writer.write_function naga/src/back/spv/writer.rs:1260 — MethodTooLong — write_function runs 391 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 291 over it, 3.91× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Writer.write_expr_plain_form naga/src/back/wgsl/writer.rs:1502 — MethodTooLong — write_expr_plain_form runs 391 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 291 over it, 3.91× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: RenderPassInfo.start wgpu-core/src/command/render.rs:1219 — MethodTooLong — start runs 382 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 282 over it, 3.82× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Lowerer.statement naga/src/front/wgsl/lower/mod.rs:1810 — MethodTooLong — statement runs 381 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 281 over it, 3.81× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Writer.write_ray_query_get_intersection_function naga/src/back/spv/ray/query.rs:15 — MethodTooLong — write_ray_query_get_intersection_function runs 379 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 279 over it, 3.79× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: CapabilitiesQuery.new wgpu-hal/src/metal/adapter.rs:675 — MethodTooLong — new runs 369 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 269 over it, 3.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.
  • MethodTooLong: Writer.write_stmt naga/src/back/wgsl/writer.rs:746 — MethodTooLong — write_stmt runs 366 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 266 over it, 3.66× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • + 127 more in this group — see findings.md.
D3 · God Classes · FileTooLong · ×85
  • FileTooLong: msl/writer.rs naga/src/back/msl/writer.rs — FileTooLong — 6070 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 5570 over it, 12.14× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: device/resource.rs wgpu-core/src/device/resource.rs — FileTooLong — 3819 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 95% of them inside a single declaration: Device (6 blocks, 235-5961). The bar is 500 significant lines; this is 3319 over it, 7.64× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: hlsl/writer.rs naga/src/back/hlsl/writer.rs — FileTooLong — 3526 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 94% of them inside a single declaration: Writer (154-4941). The bar is 500 significant lines; this is 3026 over it, 7.05× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: lower/mod.rs naga/src/front/wgsl/lower/mod.rs — FileTooLong — 3295 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 78% of them inside a single declaration: Lowerer (2 blocks, 1280-5092). The bar is 500 significant lines; this is 2795 over it, 6.59× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: command/render.rs wgpu-core/src/command/render.rs — FileTooLong — 3094 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 2594 over it, 6.19× 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: backend/webgpu.rs wgpu/src/backend/webgpu.rs — FileTooLong — 3042 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 54 free functions. The bar is 500 significant lines; this is 2542 over it, 6.08× 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: spv/block.rs naga/src/back/spv/block.rs — FileTooLong — 2872 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 2372 over it, 5.74× 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: proc/constant_evaluator.rs naga/src/proc/constant_evaluator.rs — FileTooLong — 2843 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 70% of them inside a single declaration: ConstantEvaluator (2 blocks, 683-3816). The bar is 500 significant lines; this is 2343 over it, 5.69× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: glsl/writer.rs naga/src/back/glsl/writer.rs — FileTooLong — 2814 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 2314 over it, 5.63× 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: spv/writer.rs naga/src/back/spv/writer.rs — FileTooLong — 2712 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 98% of them inside a single declaration: Writer (68-4050). The bar is 500 significant lines; this is 2212 over it, 5.42× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: src/resource.rs wgpu-core/src/resource.rs — FileTooLong — 2400 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1900 over it, 4.80× 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: vulkan/adapter.rs wgpu-hal/src/vulkan/adapter.rs — FileTooLong — 2295 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1795 over it, 4.59× 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: spv/next_block.rs naga/src/front/spv/next_block.rs — FileTooLong — 2257 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 99% of them inside a single declaration: Frontend (15-3107). The bar is 500 significant lines; this is 1757 over it, 4.51× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: vulkan/device.rs wgpu-hal/src/vulkan/device.rs — FileTooLong — 2185 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 88% of them inside a single declaration: Device (2 blocks, 302-3072). The bar is 500 significant lines; this is 1685 over it, 4.37× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: spv/mod.rs naga/src/front/spv/mod.rs — FileTooLong — 2137 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 83% of them inside a single declaration: Frontend (2 blocks, 612-3222). The bar is 500 significant lines; this is 1637 over it, 4.27× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: backend/wgpu_core.rs wgpu/src/backend/wgpu_core.rs — FileTooLong — 1993 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1493 over it, 3.99× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: dx12/device.rs wgpu-hal/src/dx12/device.rs — FileTooLong — 1911 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 99% of them inside a single declaration: Device (2 blocks, 40-2787). The bar is 500 significant lines; this is 1411 over it, 3.82× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: parse/mod.rs naga/src/front/wgsl/parse/mod.rs — FileTooLong — 1621 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1121 over it, 3.24× 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: metal/device.rs wgpu-hal/src/metal/device.rs — FileTooLong — 1599 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 92% of them inside a single declaration: Device (2 blocks, 162-2265). The bar is 500 significant lines; this is 1099 over it, 3.20× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: glsl/builtins.rs naga/src/front/glsl/builtins.rs — FileTooLong — 1581 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1081 over it, 3.16× 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: hlsl/help.rs naga/src/back/hlsl/help.rs — FileTooLong — 1534 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1034 over it, 3.07× 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: src/validation.rs wgpu-core/src/validation.rs — FileTooLong — 1533 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1033 over it, 3.07× 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: gles/queue.rs wgpu-hal/src/gles/queue.rs — FileTooLong — 1498 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 98% of them inside a single declaration: Queue (2 blocks, 53-2008). The bar is 500 significant lines; this is 998 over it, 3.00× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: wgsl/writer.rs naga/src/back/wgsl/writer.rs — FileTooLong — 1459 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 93% of them inside a single declaration: Writer (2 blocks, 82-2141). The bar is 500 significant lines; this is 959 over it, 2.92× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: valid/function.rs naga/src/valid/function.rs — FileTooLong — 1446 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 80% of them inside a single declaration: Validator (348-1998). The bar is 500 significant lines; this is 946 over it, 2.89× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • + 60 more in this group — see findings.md.
D2 · Cognitive Complexity · Writer · ×60
  • Writer::write_functions (cognitive 543) naga/src/back/msl/writer.rs:6871 — Writer::write_functions has cognitive complexity 543 (threshold 15). Drivers by points: if/else 96 (316 pts), match/switch 33 (125 pts), loops 29 (86 pts), boolean chains 16 (nesting depth added 369). 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.
  • Writer::write_expr (cognitive 391) naga/src/back/glsl/writer.rs:2425 — Writer::write_expr has cognitive complexity 391 (threshold 15). Drivers by points: if/else 102 (235 pts), match/switch 49 (130 pts), boolean chains 15, loops 4 (11 pts) (nesting depth added 221). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Writer::write_stmt (cognitive 201) naga/src/back/hlsl/writer.rs:2187 — Writer::write_stmt has cognitive complexity 201 (threshold 15). Drivers by points: if/else 47 (117 pts), match/switch 23 (62 pts), loops 8 (20 pts), boolean chains 2 (nesting depth added 121). 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.
  • Writer::write_expr (cognitive 196) naga/src/back/hlsl/writer.rs:3735 — Writer::write_expr has cognitive complexity 196 (threshold 15). Drivers by points: if/else 51 (113 pts), match/switch 28 (74 pts), boolean chains 7, loops 1 (2 pts) (nesting depth added 109). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Writer::write_stmt (cognitive 166) naga/src/back/glsl/writer.rs:1605 — Writer::write_stmt has cognitive complexity 166 (threshold 15). Drivers by points: if/else 36 (96 pts), match/switch 13 (34 pts), loops 10 (30 pts), boolean chains 6 (nesting depth added 101). 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.
  • Writer::put_expression (cognitive 163) naga/src/back/msl/writer.rs:2126 — Writer::put_expression has cognitive complexity 163 (threshold 15). Drivers by points: if/else 40 (79 pts), match/switch 28 (71 pts), boolean chains 11, loops 1 (2 pts) (nesting depth added 83). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Writer::put_block (cognitive 158) naga/src/back/msl/writer.rs:3915 — Writer::put_block has cognitive complexity 158 (threshold 15). Drivers by points: if/else 37 (108 pts), match/switch 8 (26 pts), loops 8 (20 pts), boolean chains 4 (nesting depth added 101). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Writer::collect_required_features (cognitive 129) naga/src/back/glsl/features.rs:332 — Writer::collect_required_features has cognitive complexity 129 (threshold 15). Drivers by points: if/else 22 (79 pts), match/switch 8 (23 pts), boolean chains 14, loops 8 (13 pts) (nesting depth added 77). 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.
  • Writer::write_function (cognitive 125) naga/src/back/spv/writer.rs:1260 — Writer::write_function has cognitive complexity 125 (threshold 15). Drivers by points: if/else 48 (94 pts), loops 8 (14 pts), match/switch 6 (12 pts), boolean chains 5 (nesting depth added 58). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Writer::write_stmt (cognitive 120) naga/src/back/wgsl/writer.rs:746 — Writer::write_stmt has cognitive complexity 120 (threshold 15). Drivers by points: if/else 33 (75 pts), loops 10 (23 pts), match/switch 8 (19 pts), boolean chains 3 (nesting depth added 66). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Writer::write (cognitive 95) naga/src/back/glsl/writer.rs:132 — Writer::write has cognitive complexity 95 (threshold 15). Drivers by points: if/else 31 (63 pts), match/switch 6 (19 pts), boolean chains 7, loops 6 (nesting depth added 45). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Writer::write_function (cognitive 80) naga/src/back/hlsl/writer.rs:1622 — Writer::write_function has cognitive complexity 80 (threshold 15). Drivers by points: if/else 32 (59 pts), loops 5 (9 pts), match/switch 5 (8 pts), boolean chains 4 (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.
  • Writer::write_expr_plain_form (cognitive 77) naga/src/back/wgsl/writer.rs:1502 — Writer::write_expr_plain_form has cognitive complexity 77 (threshold 15). Drivers by points: if/else 20 (40 pts), match/switch 16 (31 pts), loops 2 (5 pts), boolean chains 1 (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Writer::write_math_expression (cognitive 76) naga/src/back/hlsl/writer.rs:3067 — Writer::write_math_expression has cognitive complexity 76 (threshold 15). Drivers by points: if/else 26 (50 pts), match/switch 12 (24 pts), boolean chains 2 (nesting depth added 36). 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.
  • Writer::write_wrapped_functions (cognitive 68) naga/src/back/hlsl/help.rs:1844 — Writer::write_wrapped_functions has cognitive complexity 68 (threshold 15). Drivers by points: if/else 10 (35 pts), match/switch 10 (28 pts), loops 2 (5 pts) (nesting depth added 46). Of this number, 53 points are the body's own statements and 15 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Writer::write (cognitive 67) naga/src/back/hlsl/writer.rs:324 — Writer::write has cognitive complexity 67 (threshold 15). Drivers by points: if/else 18 (43 pts), loops 9 (12 pts), match/switch 3 (10 pts), boolean chains 2 (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Writer::write_std140_compat_type_declaration (cognitive 66) naga/src/back/spv/writer.rs:2368 — Writer::write_std140_compat_type_declaration has cognitive complexity 66 (threshold 15). Drivers by points: if/else 10 (36 pts), match/switch 6 (18 pts), loops 4 (12 pts) (nesting depth added 46). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Writer::write_wrapper_function (cognitive 58) naga/src/back/msl/mesh_shader.rs:149 — Writer::write_wrapper_function has cognitive complexity 58 (threshold 15). Drivers by points: if/else 22 (38 pts), loops 7 (14 pts), match/switch 3 (4 pts), boolean chains 2 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Writer::write_entry_point_mesh_shader_info (cognitive 58) naga/src/back/spv/mesh_shader.rs:72 — Writer::write_entry_point_mesh_shader_info has cognitive complexity 58 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 8 (20 pts), match/switch 8 (18 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.
  • Writer::write_logical_layout (cognitive 55) naga/src/back/spv/writer.rs:3736 — Writer::write_logical_layout has cognitive complexity 55 (threshold 15). Drivers by points: if/else 21 (33 pts), loops 12 (14 pts), boolean chains 4, match/switch 3 (4 pts) (nesting depth added 15). Of this number, 54 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Writer::write_global_variable (cognitive 52) naga/src/back/spv/writer.rs:3475 — Writer::write_global_variable has cognitive complexity 52 (threshold 15). Drivers by points: if/else 20 (43 pts), match/switch 5 (9 pts) (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.
  • Writer::write_switch (cognitive 51) naga/src/back/hlsl/writer.rs:2022 — Writer::write_switch has cognitive complexity 51 (threshold 15). Drivers by points: if/else 12 (25 pts), loops 5 (18 pts), boolean chains 4, match/switch 2 (4 pts) (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Writer::map_binding (cognitive 50) naga/src/back/spv/writer.rs:3141 — Writer::map_binding has cognitive complexity 50 (threshold 15). Drivers by points: if/else 10 (23 pts), match/switch 8 (22 pts), boolean chains 5 (nesting depth added 27). 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.
  • Writer::write_type_defs (cognitive 49) naga/src/back/msl/writer.rs:4695 — Writer::write_type_defs has cognitive complexity 49 (threshold 15). Drivers by points: if/else 11 (28 pts), match/switch 5 (13 pts), loops 4 (8 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.
  • Writer::write_wrapped_binary_ops (cognitive 44) naga/src/back/hlsl/help.rs:1593 — Writer::write_wrapped_binary_ops has cognitive complexity 44 (threshold 15). Drivers by points: if/else 7 (26 pts), match/switch 5 (17 pts), loops 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.
  • + 35 more in this group — see findings.md.
D1 · Cyclomatic Complexity · Writer · ×47
  • Writer::write_expr (cyclomatic 300) naga/src/back/glsl/writer.rs:2425 — Writer::write_expr has cyclomatic complexity 300 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Writer::put_expression (cyclomatic 205) naga/src/back/msl/writer.rs:2126 — Writer::put_expression has cyclomatic complexity 205 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Writer::write_functions (cyclomatic 183) naga/src/back/msl/writer.rs:6871 — Writer::write_functions has cyclomatic complexity 183 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Writer::write_math_expression (cyclomatic 135) naga/src/back/hlsl/writer.rs:3067 — Writer::write_math_expression has cyclomatic complexity 135 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Writer::write_expr (cyclomatic 128) naga/src/back/hlsl/writer.rs:3735 — Writer::write_expr has cyclomatic complexity 128 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Writer::write_stmt (cyclomatic 122) naga/src/back/hlsl/writer.rs:2187 — Writer::write_stmt has cyclomatic complexity 122 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Writer::write_stmt (cyclomatic 103) naga/src/back/glsl/writer.rs:1605 — Writer::write_stmt has cyclomatic complexity 103 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Writer::put_block (cyclomatic 95) naga/src/back/msl/writer.rs:3915 — Writer::put_block has cyclomatic complexity 95 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Writer::write_stmt (cyclomatic 90) naga/src/back/wgsl/writer.rs:746 — Writer::write_stmt has cyclomatic complexity 90 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Writer::write_expr_plain_form (cyclomatic 80) naga/src/back/wgsl/writer.rs:1502 — Writer::write_expr_plain_form has cyclomatic complexity 80 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Writer::map_binding (cyclomatic 73) naga/src/back/spv/writer.rs:3141 — Writer::map_binding has cyclomatic complexity 73 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Writer::collect_required_features (cyclomatic 62) naga/src/back/glsl/features.rs:332 — Writer::collect_required_features 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.
  • Writer::write_function (cyclomatic 56) naga/src/back/spv/writer.rs:1260 — Writer::write_function 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.
  • Writer::write (cyclomatic 47) naga/src/back/glsl/writer.rs:132 — Writer::write has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Writer::write_function (cyclomatic 40) naga/src/back/hlsl/writer.rs:1622 — Writer::write_function has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Writer::write_logical_layout (cyclomatic 40) naga/src/back/spv/writer.rs:3736 — Writer::write_logical_layout has cyclomatic complexity 40 (threshold 15). Of this number, 39 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Writer::write_enable_declarations (cyclomatic 38) naga/src/back/wgsl/writer.rs:287 — Writer::write_enable_declarations has cyclomatic complexity 38 (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.
  • Writer::write_wrapper_function (cyclomatic 33) naga/src/back/msl/mesh_shader.rs:149 — Writer::write_wrapper_function 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.
  • Writer::write (cyclomatic 33) naga/src/back/hlsl/writer.rs:324 — Writer::write 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.
  • Writer::write_wrapped_functions (cyclomatic 30) naga/src/back/hlsl/help.rs:1844 — Writer::write_wrapped_functions has cyclomatic complexity 30 (threshold 15). Of this number, 25 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Writer::write_global (cyclomatic 30) naga/src/back/hlsl/writer.rs:1024 — Writer::write_global 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.
  • Writer::write_entry_point_mesh_shader_info (cyclomatic 29) naga/src/back/spv/mesh_shader.rs:72 — Writer::write_entry_point_mesh_shader_info has cyclomatic complexity 29 (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.
  • Writer::write_wrapped_binary_op (cyclomatic 28) naga/src/back/msl/writer.rs:5956 — Writer::write_wrapped_binary_op 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. This is NOT this file's highest cyclomatic complexity: Writer::write_unpacking_function (cyclomatic 43) 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 function is counted neither in this dimension's figures nor in its score.
  • Writer::write_image_load (cyclomatic 26) naga/src/back/glsl/writer.rs:4083 — Writer::write_image_load 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.
  • Writer::write_attributes_to (cyclomatic 26) naga/src/back/wgsl/writer.rs:592 — Writer::write_attributes_to has cyclomatic complexity 26 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • + 22 more in this group — see findings.md.
D15 · Churn × Complexity Hotspots · Hotspot · ×37
  • Hotspot: wgpu-core/src/device/resource.rs wgpu-core/src/device/resource.rs:4731 — wgpu-core/src/device/resource.rs changed 59 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 119 in Device::create_render_pipeline_or_error_inner at line 4731. 15 of those changes were fix/bug commits, and the other 44 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-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 12:53:00 +00:00' --until='2026-10-25 12:53:00 +00:00' --full-history --no-merges -- wgpu-core/src/device/resource.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: wgpu-hal/src/metal/adapter.rs wgpu-hal/src/metal/adapter.rs:675 — wgpu-hal/src/metal/adapter.rs changed 16 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 133 in CapabilitiesQuery::new at line 675. 4 of those changes were fix/bug commits, and the other 12 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-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 12:53:00 +00:00' --until='2026-10-25 12:53:00 +00:00' --full-history --no-merges -- wgpu-hal/src/metal/adapter.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: wgpu/src/backend/wgpu_core.rs wgpu/src/backend/wgpu_core.rs:1042 — wgpu/src/backend/wgpu_core.rs changed 83 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 19 in CoreDevice::create_bind_group at line 1042. 2 of those changes were fix/bug commits, and the other 81 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-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 12:53:00 +00:00' --until='2026-10-25 12:53:00 +00:00' --full-history --no-merges -- wgpu/src/backend/wgpu_core.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: player/src/lib.rs player/src/lib.rs:100 — player/src/lib.rs changed 27 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 54 in Player::process at line 100. 1 of those changes was a fix/bug commit, and the other 26 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-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 12:53:00 +00:00' --until='2026-10-25 12:53:00 +00:00' --full-history --no-merges -- player/src/lib.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: wgpu-core/src/resource.rs wgpu-core/src/resource.rs:1946 — wgpu-core/src/resource.rs changed 26 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 48 in Texture::create_view_inner at line 1946. 3 of those changes were fix/bug commits, and the other 23 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-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 12:53:00 +00:00' --until='2026-10-25 12:53:00 +00:00' --full-history --no-merges -- wgpu-core/src/resource.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: wgpu-core/src/command/render.rs wgpu-core/src/command/render.rs:1219 — wgpu-core/src/command/render.rs changed 18 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 59 in RenderPassInfo::start at line 1219. 6 of those changes were fix/bug commits, and the other 12 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-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 12:53:00 +00:00' --until='2026-10-25 12:53:00 +00:00' --full-history --no-merges -- wgpu-core/src/command/render.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: wgpu-core/src/validation.rs wgpu-core/src/validation.rs:1588 — wgpu-core/src/validation.rs changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 85 in Interface::check_stage at line 1588. 4 of those changes were fix/bug commits, and the other 8 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-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 12:53:00 +00:00' --until='2026-10-25 12:53:00 +00:00' --full-history --no-merges -- wgpu-core/src/validation.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: naga/src/valid/interface.rs naga/src/valid/interface.rs:234 — naga/src/valid/interface.rs changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 133 in VaryingContext::validate_impl at line 234. 3 of those changes were fix/bug commits, and the other 4 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-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 12:53:00 +00:00' --until='2026-10-25 12:53:00 +00:00' --full-history --no-merges -- naga/src/valid/interface.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: naga/src/back/msl/writer.rs naga/src/back/msl/writer.rs:6871 — naga/src/back/msl/writer.rs changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 183 in Writer::write_functions at line 6871. 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-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 12:53:00 +00:00' --until='2026-10-25 12:53:00 +00:00' --full-history --no-merges -- naga/src/back/msl/writer.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: wgpu-hal/src/vulkan/adapter.rs wgpu-hal/src/vulkan/adapter.rs:1230 — wgpu-hal/src/vulkan/adapter.rs changed 19 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 48 in PhysicalDeviceProperties::get_required_extensions at line 1230. 7 of those changes were fix/bug commits, and the other 12 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-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 12:53:00 +00:00' --until='2026-10-25 12:53:00 +00:00' --full-history --no-merges -- wgpu-hal/src/vulkan/adapter.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: naga/src/back/hlsl/writer.rs naga/src/back/hlsl/writer.rs:3735 — naga/src/back/hlsl/writer.rs changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 128 in Writer::write_expr at line 3735. 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-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 12:53:00 +00:00' --until='2026-10-25 12:53:00 +00:00' --full-history --no-merges -- naga/src/back/hlsl/writer.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: wgpu-types/src/features.rs wgpu-types/src/features.rs:213 — wgpu-types/src/features.rs changed 11 times in last 90 days, max cyclomatic complexity 78 in Features::from_name at line 213. 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-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 12:53:00 +00:00' --until='2026-10-25 12:53:00 +00:00' --full-history --no-merges -- wgpu-types/src/features.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: wgpu-hal/src/dx12/adapter.rs wgpu-hal/src/dx12/adapter.rs:65 — wgpu-hal/src/dx12/adapter.rs changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 103 in Adapter::expose at line 65. 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-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 12:53:00 +00:00' --until='2026-10-25 12:53:00 +00:00' --full-history --no-merges -- wgpu-hal/src/dx12/adapter.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: wgpu-hal/src/gles/queue.rs wgpu-hal/src/gles/queue.rs:192 — wgpu-hal/src/gles/queue.rs changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 177 in Queue::process at line 192. 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-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 12:53:00 +00:00' --until='2026-10-25 12:53:00 +00:00' --full-history --no-merges -- wgpu-hal/src/gles/queue.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: wgpu-hal/src/gles/adapter.rs wgpu-hal/src/gles/adapter.rs:195 — wgpu-hal/src/gles/adapter.rs changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 96 in Adapter::expose at line 195. 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-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 12:53:00 +00:00' --until='2026-10-25 12:53:00 +00:00' --full-history --no-merges -- wgpu-hal/src/gles/adapter.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: naga/src/front/wgsl/error.rs naga/src/front/wgsl/error.rs:678 — naga/src/front/wgsl/error.rs changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 123 in Error::as_parse_error at line 678. 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-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 12:53:00 +00:00' --until='2026-10-25 12:53:00 +00:00' --full-history --no-merges -- naga/src/front/wgsl/error.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: wgpu-core/src/device/queue.rs wgpu-core/src/device/queue.rs:1624 — wgpu-core/src/device/queue.rs changed 19 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 24 in Queue::submit_inner 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-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 12:53:00 +00:00' --until='2026-10-25 12:53:00 +00:00' --full-history --no-merges -- wgpu-core/src/device/queue.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: naga/src/valid/function.rs naga/src/valid/function.rs:789 — naga/src/valid/function.rs changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 133 in Validator::validate_block_impl at line 789. 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-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 12:53:00 +00:00' --until='2026-10-25 12:53:00 +00:00' --full-history --no-merges -- naga/src/valid/function.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: naga/src/front/wgsl/lower/mod.rs naga/src/front/wgsl/lower/mod.rs:1810 — naga/src/front/wgsl/lower/mod.rs changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 51 in Lowerer::statement at line 1810. 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-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 12:53:00 +00:00' --until='2026-10-25 12:53:00 +00:00' --full-history --no-merges -- naga/src/front/wgsl/lower/mod.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: naga/src/back/glsl/writer.rs naga/src/back/glsl/writer.rs:1605 — naga/src/back/glsl/writer.rs changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 103 in Writer::write_stmt at line 1605. 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-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 12:53:00 +00:00' --until='2026-10-25 12:53:00 +00:00' --full-history --no-merges -- naga/src/back/glsl/writer.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: naga/src/back/spv/writer.rs naga/src/back/spv/writer.rs:3141 — naga/src/back/spv/writer.rs changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 73 in Writer::map_binding at line 3141. 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-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 12:53:00 +00:00' --until='2026-10-25 12:53:00 +00:00' --full-history --no-merges -- naga/src/back/spv/writer.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: wgpu-hal/src/metal/device.rs wgpu-hal/src/metal/device.rs:163 — wgpu-hal/src/metal/device.rs changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 29 in Device::load_shader at line 163. 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-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 12:53:00 +00:00' --until='2026-10-25 12:53:00 +00:00' --full-history --no-merges -- wgpu-hal/src/metal/device.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: wgpu-core-remote/src/global/render_pass.rs wgpu-core-remote/src/global/render_pass.rs:415 — wgpu-core-remote/src/global/render_pass.rs changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 20 in Global::handle_render_pass_command at line 415. 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-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 12:53:00 +00:00' --until='2026-10-25 12:53:00 +00:00' --full-history --no-merges -- wgpu-core-remote/src/global/render_pass.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: wgpu-core/src/lock/rank.rs wgpu-core/src/lock/rank.rs:74 — wgpu-core/src/lock/rank.rs changed 7 times in last 90 days, max cyclomatic complexity 33 in LockRankSet::member_name at line 74. 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-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 12:53:00 +00:00' --until='2026-10-25 12:53:00 +00:00' --full-history --no-merges -- wgpu-core/src/lock/rank.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: wgpu-hal/src/metal/surface.rs wgpu-hal/src/metal/surface.rs:250 — wgpu-hal/src/metal/surface.rs changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 19 in Surface::configure at line 250. 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-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 12:53:00 +00:00' --until='2026-10-25 12:53:00 +00:00' --full-history --no-merges -- wgpu-hal/src/metal/surface.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • + 12 more in this group — see findings.md.
D3 · God Classes · FunctionTooLong · ×28
  • FunctionTooLong: naga::front::glsl::builtins::inject_standard_builtins naga/src/front/glsl/builtins.rs:462 — FunctionTooLong — naga::front::glsl::builtins::inject_standard_builtins runs 398 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 298 over it, 3.98× 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: wgpu_core::command::render::encode_render_pass wgpu-core/src/command/render.rs:2265 — FunctionTooLong — wgpu_core::command::render::encode_render_pass runs 373 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 273 over it, 3.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: wgpu_xtask::cts::run_cts xtask/src/cts.rs:66 — FunctionTooLong — wgpu_xtask::cts::run_cts runs 291 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 191 over it, 2.91× 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: wgpu_core::device::trace::record::action_to_owned wgpu-core/src/device/trace/record.rs:875 — FunctionTooLong — wgpu_core::device::trace::record::action_to_owned runs 245 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 145 over it, 2.45× 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: naga::back::dot::write_function_expressions naga/src/back/dot/mod.rs:571 — FunctionTooLong — naga::back::dot::write_function_expressions runs 228 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 128 over it, 2.28× 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: naga::front::glsl::builtins::inject_builtin naga/src/front/glsl/builtins.rs:78 — FunctionTooLong — naga::front::glsl::builtins::inject_builtin runs 224 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 124 over it, 2.24× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: wgpu_core::command::compute::encode_compute_pass wgpu-core/src/command/compute.rs:622 — FunctionTooLong — wgpu_core::command::compute::encode_compute_pass runs 218 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 118 over it, 2.18× 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: player::bin::play::main player/src/bin/play.rs:4 — FunctionTooLong — player::bin::play::main runs 211 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 111 over it, 2.11× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: naga::front::glsl::builtins::inject_common_builtin naga/src/front/glsl/builtins.rs:1220 — FunctionTooLong — naga::front::glsl::builtins::inject_common_builtin runs 207 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 107 over it, 2.07× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: wgpu_core::command::ray_tracing::build_acceleration_structures wgpu-core/src/command/ray_tracing.rs:195 — FunctionTooLong — wgpu_core::command::ray_tracing::build_acceleration_structures runs 196 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 96 over it, 1.96× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: naga::back::pipeline_constants::adjust_stmt naga/src/back/pipeline_constants.rs:721 — FunctionTooLong — naga::back::pipeline_constants::adjust_stmt runs 182 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 82 over it, 1.82× 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: naga::back::pipeline_constants::adjust_expr naga/src/back/pipeline_constants.rs:488 — FunctionTooLong — naga::back::pipeline_constants::adjust_expr runs 181 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 81 over it, 1.81× 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: naga::compact::compact naga/src/compact/mod.rs:68 — FunctionTooLong — naga::compact::compact runs 164 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 64 over it, 1.64× 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: wgpu_info::human::print_adapter wgpu-info/src/human.rs:80 — FunctionTooLong — wgpu_info::human::print_adapter runs 159 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 59 over it, 1.59× 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: naga::common::wgsl::types::try_write_type_inner naga/src/common/wgsl/types.rs:194 — FunctionTooLong — naga::common::wgsl::types::try_write_type_inner runs 157 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 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: naga_cli::bin::naga::write_output naga-cli/src/bin/naga.rs:826 — FunctionTooLong — naga_cli::bin::naga::write_output runs 145 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 45 over it, 1.45× 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: wgpu_naga_bridge::features_to_naga_capabilities wgpu-naga-bridge/src/lib.rs:9 — FunctionTooLong — wgpu_naga_bridge::features_to_naga_capabilities runs 142 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 42 over it, 1.42× 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: wgpu_core::command::render::multi_draw_indirect wgpu-core/src/command/render.rs:3192 — FunctionTooLong — wgpu_core::command::render::multi_draw_indirect runs 141 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 41 over it, 1.41× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: wgpu_core::command::compute::dispatch_workgroups_indirect wgpu-core/src/command/compute.rs:978 — FunctionTooLong — wgpu_core::command::compute::dispatch_workgroups_indirect runs 131 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 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: naga::front::glsl::types::parse_type naga/src/front/glsl/types.rs:9 — FunctionTooLong — naga::front::glsl::types::parse_type runs 127 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 27 over it, 1.27× 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: naga::front::wgsl::parse::lexer::consume_token naga/src/front/wgsl/parse/lexer.rs:279 — FunctionTooLong — naga::front::wgsl::parse::lexer::consume_token runs 125 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 25 over it, 1.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: naga::front::wgsl::parse::conv::map_predeclared_type naga/src/front/wgsl/parse/conv.rs:448 — FunctionTooLong — naga::front::wgsl::parse::conv::map_predeclared_type runs 124 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 24 over it, 1.24× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: naga::front::wgsl::parse::number::parse naga/src/front/wgsl/parse/number.rs:88 — FunctionTooLong — naga::front::wgsl::parse::number::parse runs 122 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 22 over it, 1.22× 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: lock_analyzer::main lock-analyzer/src/main.rs:29 — FunctionTooLong — lock_analyzer::main runs 119 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 19 over it, 1.19× 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: naga::back::pipeline_constants::process_overrides naga/src/back/pipeline_constants.rs:71 — FunctionTooLong — naga::back::pipeline_constants::process_overrides runs 113 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 13 over it, 1.13× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • + 3 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×27
  • Duplicated block (7 lines × 2) deno_webgpu/lib.rs:395 — deno_webgpu/lib.rs:395-401 | deno_webgpu/lib.rs:438-444 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) naga/src/back/glsl/writer.rs:3455 — naga/src/back/glsl/writer.rs:3455-3461 | naga/src/back/glsl/writer.rs:3477-3483 — both copies are in the same file, so extract the 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) naga/src/back/hlsl/help.rs:1245 — naga/src/back/hlsl/help.rs:1245-1251 | naga/src/back/msl/writer.rs:4866-4872 — 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) naga/src/back/hlsl/storage.rs:186 — naga/src/back/hlsl/storage.rs:186-192 | naga/src/back/hlsl/storage.rs:349-355 — both copies are in the same file, so extract the 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) naga/src/back/hlsl/writer.rs:3509 — naga/src/back/hlsl/writer.rs:3509-3515 | naga/src/back/hlsl/writer.rs:3553-3559 — both copies are in the same file, so extract the 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) naga/src/back/hlsl/writer.rs:3827 — naga/src/back/hlsl/writer.rs:3827-3844 | naga/src/back/hlsl/writer.rs:3854-3860 — both copies are in the same file, so extract the 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) naga/src/back/msl/writer.rs:6409 — naga/src/back/msl/writer.rs:6409-6415 | naga/src/back/msl/writer.rs:6626-6632 — both copies are in the same file, so extract the 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) naga/src/front/spv/mod.rs:1006 — naga/src/front/spv/mod.rs:1006-1012 | naga/src/front/spv/mod.rs:1316-1322 — both copies are in the same file, so extract the 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) naga/src/front/spv/next_block.rs:2437 — naga/src/front/spv/next_block.rs:2437-2443 | naga/src/front/spv/next_block.rs:2477-2483 — both copies are in the same file, so extract the 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) naga/src/front/wgsl/lower/mod.rs:1503 — naga/src/front/wgsl/lower/mod.rs:1503-1509 | naga/src/front/wgsl/lower/mod.rs:2340-2346 — both copies are in the same file, so extract the 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) naga/src/front/wgsl/lower/mod.rs:4730 — naga/src/front/wgsl/lower/mod.rs:4730-4736 | naga/src/front/wgsl/lower/mod.rs:4775-4781 — both copies are in the same file, so extract the 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) naga/src/front/wgsl/parse/lexer.rs:395 — naga/src/front/wgsl/parse/lexer.rs:395-401 | naga/src/front/wgsl/parse/lexer.rs:404-410 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) naga/src/front/wgsl/parse/mod.rs:1654 — naga/src/front/wgsl/parse/mod.rs:1654-1660 | naga/src/front/wgsl/parse/mod.rs:1887-1893 — both copies are in the same file, so extract the 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) naga/src/front/wgsl/parse/number.rs:457 — naga/src/front/wgsl/parse/number.rs:457-463 | naga/src/front/wgsl/parse/number.rs:474-480 — both copies are in the same file, so extract the 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) wgpu-core/src/device/resource.rs:2614 — wgpu-core/src/device/resource.rs:2614-2620 | wgpu-core/src/device/resource.rs:2640-2646 — both copies are in the same file, so extract the 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) wgpu-core/src/indirect_validation/dispatch.rs:87 — wgpu-core/src/indirect_validation/dispatch.rs:87-93 | wgpu-core/src/timestamp_normalization/mod.rs:143-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.
  • Duplicated block (7 lines × 2) wgpu-core/src/indirect_validation/dispatch.rs:274 — wgpu-core/src/indirect_validation/dispatch.rs:274-280 | wgpu-core/src/indirect_validation/draw.rs:160-166 — before extracting anything, compare `wgpu-core/src/indirect_validation/dispatch.rs` and `wgpu-core/src/indirect_validation/draw.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 83 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) wgpu-hal/src/gles/device.rs:1685 — wgpu-hal/src/gles/device.rs:1685-1691 | wgpu-hal/src/gles/device.rs:1721-1727 — both copies are in the same file, so extract the 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) wgpu-core/src/command/compute.rs:308 — wgpu-core/src/command/compute.rs:308-314 | wgpu-core/src/command/render.rs:723-729 — before extracting anything, compare `wgpu-core/src/command/compute.rs` and `wgpu-core/src/command/render.rs` as WHOLE FILES: this scan already matched 6 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 (7 lines × 2) wgpu-core/src/pipeline.rs:713 — wgpu-core/src/pipeline.rs:713-719 | wgpu-core/src/resource.rs:3109-3115 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (7 lines × 2) naga/src/arena/mod.rs:212 — naga/src/arena/mod.rs:212-218 | naga/src/arena/unique_arena.rs:179-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 (7 lines × 2) wgpu-core/src/command/compute.rs:1359 — wgpu-core/src/command/compute.rs:1359-1365 | wgpu-core/src/command/render.rs:4382-4388 — before extracting anything, compare `wgpu-core/src/command/compute.rs` and `wgpu-core/src/command/render.rs` as WHOLE FILES: this scan already matched 6 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 (7 lines × 2) naga/src/back/glsl/writer.rs:1807 — naga/src/back/glsl/writer.rs:1807-1815 | naga/src/back/msl/writer.rs:4062-4068 — `naga/src/back/glsl/writer.rs` and `naga/src/back/msl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 66 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) wgpu-info/src/human.rs:31 — wgpu-info/src/human.rs:31-37 | wgpu-info/src/human.rs:44-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.
  • Duplicated block (7 lines × 2) naga/src/back/hlsl/writer.rs:3487 — naga/src/back/hlsl/writer.rs:3487-3493 | naga/src/back/hlsl/writer.rs:3501-3507 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 2 more in this group — see findings.md.
D2 · Cognitive Complexity · Device · ×26
  • Device::create_render_pipeline_or_error_inner (cognitive 232) wgpu-core/src/device/resource.rs:4731 — Device::create_render_pipeline_or_error_inner has cognitive complexity 232 (threshold 15). Drivers by points: if/else 85 (177 pts), loops 10 (25 pts), boolean chains 18, match/switch 10 (12 pts) (nesting depth added 109). 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.
  • Device::create_render_pipeline (cognitive 83) wgpu-hal/src/metal/device.rs:1424 — Device::create_render_pipeline has cognitive complexity 83 (threshold 15). Drivers by points: if/else 26 (49 pts), match/switch 16 (19 pts), loops 5 (13 pts), boolean chains 2 (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Device::create_pipeline_layout (cognitive 73) wgpu-hal/src/dx12/device.rs:970 — Device::create_pipeline_layout has cognitive complexity 73 (threshold 15). Drivers by points: if/else 21 (35 pts), match/switch 6 (22 pts), loops 8 (16 pts) (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Device::create_bind_group (cognitive 69) wgpu-hal/src/metal/device.rs:1088 — Device::create_bind_group has cognitive complexity 69 (threshold 15). Drivers by points: if/else 10 (33 pts), loops 6 (23 pts), match/switch 3 (13 pts) (nesting depth added 50). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Device::create_pipeline_layout (cognitive 60) wgpu-hal/src/metal/device.rs:901 — Device::create_pipeline_layout has cognitive complexity 60 (threshold 15). Drivers by points: if/else 11 (36 pts), loops 6 (12 pts), match/switch 2 (11 pts), boolean chains 1 (nesting depth added 40). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Device::validate_texture_descriptor_inner (cognitive 55) wgpu-core/src/device/resource.rs:1823 — Device::validate_texture_descriptor_inner has cognitive complexity 55 (threshold 15). Drivers by points: if/else 34 (47 pts), boolean chains 4, loops 2 (3 pts), match/switch 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.
  • Device::create_texture (cognitive 53) wgpu-hal/src/gles/device.rs:943 — Device::create_texture has cognitive complexity 53 (threshold 15). Drivers by points: if/else 17 (29 pts), loops 5 (21 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Device::create_bind_group_layout_impl (cognitive 47) wgpu-core/src/device/resource.rs:3067 — Device::create_bind_group_layout_impl has cognitive complexity 47 (threshold 15). Drivers by points: if/else 12 (26 pts), match/switch 6 (17 pts), boolean chains 2, loops 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.
  • Device::create_bind_group (cognitive 47) wgpu-hal/src/dx12/device.rs:1591 — Device::create_bind_group has cognitive complexity 47 (threshold 15). Drivers by points: loops 9 (25 pts), match/switch 4 (12 pts), if/else 6 (10 pts) (nesting depth added 28). 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.
  • Device::load_shader (cognitive 46) wgpu-hal/src/metal/device.rs:163 — Device::load_shader has cognitive complexity 46 (threshold 15). Drivers by points: match/switch 8 (27 pts), if/else 6 (15 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 29). 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.
  • Device::create_render_pipeline (cognitive 45) wgpu-hal/src/dx12/device.rs:1997 — Device::create_render_pipeline has cognitive complexity 45 (threshold 15). Drivers by points: if/else 17 (26 pts), match/switch 8 (11 pts), loops 4 (8 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Device::create_render_pipeline (cognitive 39) wgpu-hal/src/vulkan/device.rs:1986 — Device::create_render_pipeline has cognitive complexity 39 (threshold 15). Drivers by points: if/else 17 (26 pts), match/switch 4 (7 pts), loops 3 (6 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Device::create_buffer_inner (cognitive 37) wgpu-core/src/device/resource.rs:1233 — Device::create_buffer_inner has cognitive complexity 37 (threshold 15). Drivers by points: if/else 26 (32 pts), boolean chains 5 (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.
  • Device::deferred_resource_destruction (cognitive 33) wgpu-core/src/device/resource.rs:912 — Device::deferred_resource_destruction has cognitive complexity 33 (threshold 15). Drivers by points: if/else 6 (24 pts), loops 3 (7 pts), match/switch 1 (2 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Device::create_buffer (cognitive 33) wgpu-hal/src/gles/device.rs:684 — Device::create_buffer has cognitive complexity 33 (threshold 15). Drivers by points: if/else 21 (29 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.
  • Device::texture_use_parameters (cognitive 29) wgpu-core/src/device/resource.rs:4123 — Device::texture_use_parameters has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (23 pts), match/switch 3 (5 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Device::create_bind_group_layout (cognitive 29) wgpu-hal/src/vulkan/device.rs:1467 — Device::create_bind_group_layout has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (20 pts), match/switch 3 (7 pts), boolean chains 1, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Device::create_blas_inner (cognitive 27) wgpu-core/src/device/ray_tracing.rs:49 — Device::create_blas_inner has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 2 (4 pts), match/switch 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.
  • Device::maintain (cognitive 27) wgpu-core/src/device/resource.rs:1019 — Device::maintain has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15 (19 pts), match/switch 4 (6 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
  • Device::create_bind_group_inner (cognitive 24) wgpu-core/src/device/resource.rs:3820 — Device::create_bind_group_inner has cognitive complexity 24 (threshold 15). Drivers by points: loops 8 (16 pts), match/switch 2 (5 pts), if/else 2 (3 pts) (nesting depth added 12). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • Device::create_program (cognitive 24) wgpu-hal/src/gles/device.rs:530 — Device::create_program has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (12 pts), loops 6 (8 pts), match/switch 2 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Device::create_texture_inner (cognitive 22) wgpu-core/src/device/resource.rs:2106 — Device::create_texture_inner has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 3 (10 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.
  • Device::create_texture_view (cognitive 22) wgpu-hal/src/metal/device.rs:614 — Device::create_texture_view has cognitive complexity 22 (threshold 15). Drivers by points: if/else 17 (20 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.
  • Device::create_texture_view (cognitive 21) wgpu-hal/src/dx12/device.rs:656 — Device::create_texture_view has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14, match/switch 2 (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.
  • Device::create_buffer_binding (cognitive 17) wgpu-core/src/device/resource.rs:3356 — Device::create_buffer_binding has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (13 pts), match/switch 3, boolean chains 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.
  • + 1 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (11 lines × 2) · ×26
  • Duplicated block (11 lines × 2) naga/src/back/glsl/writer.rs:3179 — naga/src/back/glsl/writer.rs:3179-3189 | naga/src/back/msl/writer.rs:2586-2596 — `naga/src/back/glsl/writer.rs` and `naga/src/back/msl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 66 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) naga/src/back/hlsl/writer.rs:1887 — naga/src/back/hlsl/writer.rs:1887-1897 | naga/src/back/wgsl/writer.rs:572-582 — `naga/src/back/hlsl/writer.rs` and `naga/src/back/wgsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 18 separate duplicated blocks between them, totalling at least 185 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) naga/src/back/hlsl/writer.rs:3566 — naga/src/back/hlsl/writer.rs:3566-3576 | naga/src/back/hlsl/writer.rs:3589-3599 — both copies are in the same file, so extract the 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) naga/src/back/hlsl/writer.rs:4530 — naga/src/back/hlsl/writer.rs:4530-4540 | naga/src/back/wgsl/writer.rs:1903-1913 — `naga/src/back/hlsl/writer.rs` and `naga/src/back/wgsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 18 separate duplicated blocks between them, totalling at least 185 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) naga/src/back/pipeline_constants.rs:576 — naga/src/back/pipeline_constants.rs:576-586 | naga/src/back/pipeline_constants.rs:646-656 — both copies are in the same file, so extract the 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) naga/src/back/spv/writer.rs:2251 — naga/src/back/spv/writer.rs:2251-2261 | naga/src/back/spv/writer.rs:2263-2273 — both copies are in the same file, so extract the 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) naga/src/common/diagnostic_debug.rs:25 — naga/src/common/diagnostic_debug.rs:25-35 | naga/src/common/diagnostic_display.rs:80-90 — before extracting anything, compare `naga/src/common/diagnostic_debug.rs` and `naga/src/common/diagnostic_display.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 36 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) naga/src/front/glsl/builtins.rs:269 — naga/src/front/glsl/builtins.rs:269-279 | naga/src/front/glsl/builtins.rs:298-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 (11 lines × 2) naga/src/front/glsl/types.rs:107 — naga/src/front/glsl/types.rs:107-117 | naga/src/front/glsl/types.rs:148-158 — both copies are in the same file, so extract the 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) naga/src/proc/constant_evaluator.rs:3048 — naga/src/proc/constant_evaluator.rs:3048-3058 | naga/src/proc/constant_evaluator.rs:3093-3103 — both copies are in the same file, so extract the 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) naga/src/valid/function.rs:1565 — naga/src/valid/function.rs:1565-1575 | naga/src/valid/function.rs:1776-1786 — both copies are in the same file, so extract the 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) naga/src/valid/interface.rs:571 — naga/src/valid/interface.rs:571-581 | naga/src/valid/interface.rs:583-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 (11 lines × 2) naga/src/valid/interface.rs:1391 — naga/src/valid/interface.rs:1391-1401 | naga/src/valid/interface.rs:1441-1451 — both copies are in the same file, so extract the 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) wgpu-core/src/command/render.rs:3203 — wgpu-core/src/command/render.rs:3203-3213 | wgpu-core/src/command/render.rs:3400-3410 — both copies are in the same file, so extract the 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) wgpu-core/src/track/buffer.rs:394 — wgpu-core/src/track/buffer.rs:394-404 | wgpu-core/src/track/buffer.rs:428-438 — both copies are in the same file, so extract the 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) wgpu-hal/src/gles/queue.rs:614 — wgpu-hal/src/gles/queue.rs:614-624 | wgpu-hal/src/gles/queue.rs:666-676 — both copies are in the same file, so extract the 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) wgpu-hal/src/metal/command.rs:1329 — wgpu-hal/src/metal/command.rs:1329-1339 | wgpu-hal/src/metal/command.rs:1445-1455 — both copies are in the same file, so extract the 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) wgpu/src/backend/webgpu.rs:2161 — wgpu/src/backend/webgpu.rs:2161-2171 | wgpu/src/backend/webgpu.rs:2202-2212 — both copies are in the same file, so extract the 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) wgpu/src/backend/wgpu_core.rs:1267 — wgpu/src/backend/wgpu_core.rs:1267-1277 | wgpu/src/backend/wgpu_core.rs:1350-1360 — both copies are in the same file, so extract the 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) wgpu/src/dispatch.rs:894 — wgpu/src/dispatch.rs:894-904 | wgpu/src/dispatch.rs:1046-1056 — both copies are in the same file, so extract the 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) wgpu-core/src/indirect_validation/dispatch.rs:110 — wgpu-core/src/indirect_validation/dispatch.rs:110-121 | wgpu-core/src/indirect_validation/draw.rs:577-587 — before extracting anything, compare `wgpu-core/src/indirect_validation/dispatch.rs` and `wgpu-core/src/indirect_validation/draw.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 83 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) naga-cli/src/bin/naga.rs:869 — naga-cli/src/bin/naga.rs:869-879 | naga-cli/src/bin/naga.rs:895-905 — both copies are in the same file, so extract the 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) wgpu-core/src/indirect_validation/dispatch.rs:186 — wgpu-core/src/indirect_validation/dispatch.rs:186-196 | wgpu-core/src/indirect_validation/draw.rs:119-129 — before extracting anything, compare `wgpu-core/src/indirect_validation/dispatch.rs` and `wgpu-core/src/indirect_validation/draw.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 83 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) wgpu-hal/src/auxil/dxgi/dxgi_lib.rs:33 — wgpu-hal/src/auxil/dxgi/dxgi_lib.rs:33-43 | wgpu-hal/src/dx12/mod.rs:238-248 — 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) wgpu-core/src/indirect_validation/dispatch.rs:135 — wgpu-core/src/indirect_validation/dispatch.rs:135-145 | wgpu-core/src/indirect_validation/dispatch.rs:161-171 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 1 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (6 lines × 2) · ×25
  • Duplicated block (6 lines × 2) naga/src/back/glsl/writer.rs:3532 — naga/src/back/glsl/writer.rs:3532-3537 | naga/src/back/hlsl/writer.rs:3302-3308 — `naga/src/back/glsl/writer.rs` and `naga/src/back/hlsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 86 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) naga/src/back/hlsl/writer.rs:3244 — naga/src/back/hlsl/writer.rs:3244-3249 | naga/src/back/hlsl/writer.rs:3275-3282 — both copies are in the same file, so extract the 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) naga/src/back/hlsl/writer.rs:3878 — naga/src/back/hlsl/writer.rs:3878-3883 | naga/src/back/wgsl/writer.rs:1549-1554 — `naga/src/back/hlsl/writer.rs` and `naga/src/back/wgsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 18 separate duplicated blocks between them, totalling at least 185 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) naga/src/back/hlsl/writer.rs:4170 — naga/src/back/hlsl/writer.rs:4170-4175 | naga/src/back/wgsl/writer.rs:2012-2017 — `naga/src/back/hlsl/writer.rs` and `naga/src/back/wgsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 18 separate duplicated blocks between them, totalling at least 185 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) naga/src/back/msl/writer.rs:1930 — naga/src/back/msl/writer.rs:1930-1935 | naga/src/back/msl/writer.rs:1945-1950 — both copies are in the same file, so extract the 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) naga/src/back/msl/writer.rs:7104 — naga/src/back/msl/writer.rs:7104-7109 | naga/src/back/msl/writer.rs:8326-8333 — both copies are in the same file, so extract the 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) naga/src/back/spv/writer.rs:891 — naga/src/back/spv/writer.rs:891-896 | naga/src/back/spv/writer.rs:1123-1128 — both copies are in the same file, so extract the 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) naga/src/front/spv/mod.rs:1211 — naga/src/front/spv/mod.rs:1211-1216 | naga/src/front/spv/mod.rs:1218-1223 — both copies are in the same file, so extract the 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) naga/src/front/spv/next_block.rs:470 — naga/src/front/spv/next_block.rs:470-475 | naga/src/front/spv/next_block.rs:549-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 (6 lines × 2) naga/src/front/wgsl/lower/mod.rs:3411 — naga/src/front/wgsl/lower/mod.rs:3411-3416 | naga/src/front/wgsl/lower/mod.rs:3552-3557 — both copies are in the same file, so extract the 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) naga/src/front/wgsl/parse/mod.rs:1182 — naga/src/front/wgsl/parse/mod.rs:1182-1187 | naga/src/front/wgsl/parse/mod.rs:1196-1201 — both copies are in the same file, so extract the 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) naga/src/valid/analyzer.rs:715 — naga/src/valid/analyzer.rs:715-720 | naga/src/valid/analyzer.rs:741-746 — both copies are in the same file, so extract the 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) wgpu-core/src/binding_model.rs:1744 — wgpu-core/src/binding_model.rs:1744-1749 | wgpu-core/src/resource.rs:2672-2678 — 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) wgpu-core/src/pipeline.rs:642 — wgpu-core/src/pipeline.rs:642-647 | wgpu-core/src/pipeline.rs:1292-1297 — both copies are in the same file, so extract the 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) wgpu-hal/src/vulkan/device.rs:2728 — wgpu-hal/src/vulkan/device.rs:2728-2734 | wgpu-hal/src/vulkan/device.rs:2797-2802 — both copies are in the same file, so extract the 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) wgpu-hal/src/vulkan/instance.rs:130 — wgpu-hal/src/vulkan/instance.rs:130-135 | wgpu-hal/src/vulkan/instance.rs:143-148 — both copies are in the same file, so extract the 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) wgpu-hal/src/dx12/mod.rs:1034 — wgpu-hal/src/dx12/mod.rs:1034-1039 | wgpu-hal/src/lib.rs:2333-2338 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) wgpu-hal/src/gles/device.rs:1360 — wgpu-hal/src/gles/device.rs:1360-1365 | wgpu-hal/src/metal/device.rs:889-895 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) deno_webgpu/compute_pass.rs:202 — deno_webgpu/compute_pass.rs:202-207 | deno_webgpu/render_pass.rs:367-372 — before extracting anything, compare `deno_webgpu/compute_pass.rs` and `deno_webgpu/render_pass.rs` 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 (6 lines × 2) wgpu/src/api/command_buffer.rs:41 — wgpu/src/api/command_buffer.rs:41-46 | wgpu/src/api/command_encoder.rs:457-462 — 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) naga/src/front/wgsl/parse/mod.rs:186 — naga/src/front/wgsl/parse/mod.rs:186-191 | naga/src/front/wgsl/parse/mod.rs:195-201 — both copies are in the same file, so extract the 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) naga/src/back/glsl/writer.rs:3357 — naga/src/back/glsl/writer.rs:3357-3362 | naga/src/back/glsl/writer.rs:3388-3393 — both copies are in the same file, so extract the 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) deno_webgpu/byow.rs:245 — deno_webgpu/byow.rs:245-250 | deno_webgpu/byow.rs:253-258 — both copies are in the same file, so extract the 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) naga/src/back/msl/writer.rs:2401 — naga/src/back/msl/writer.rs:2401-2406 | naga/src/back/msl/writer.rs:2410-2415 — both copies are in the same file, so extract the 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) naga/src/back/wgsl/writer.rs:928 — naga/src/back/wgsl/writer.rs:928-933 | naga/src/back/wgsl/writer.rs:1093-1098 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (10 lines × 2) · ×24
  • Duplicated block (10 lines × 2) naga/src/back/glsl/writer.rs:1672 — naga/src/back/glsl/writer.rs:1672-1688 | naga/src/back/hlsl/writer.rs:2231-2240 — `naga/src/back/glsl/writer.rs` and `naga/src/back/hlsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 86 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (10 lines × 2) naga/src/back/msl/mod.rs:599 — naga/src/back/msl/mod.rs:599-608 | naga/src/back/msl/mod.rs:620-629 — both copies are in the same file, so extract the 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) naga/src/back/msl/writer.rs:6081 — naga/src/back/msl/writer.rs:6081-6090 | naga/src/back/msl/writer.rs:6310-6319 — both copies are in the same file, so extract the 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) naga/src/back/spv/instructions.rs:793 — naga/src/back/spv/instructions.rs:793-802 | naga/src/back/spv/instructions.rs:890-899 — both copies are in the same file, so extract the 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) naga/src/back/spv/writer.rs:1502 — naga/src/back/spv/writer.rs:1502-1511 | naga/src/back/spv/writer.rs:2922-2932 — both copies are in the same file, so extract the 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) naga/src/back/wgsl/writer.rs:917 — naga/src/back/wgsl/writer.rs:917-926 | naga/src/back/wgsl/writer.rs:946-955 — both copies are in the same file, so extract the 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) naga/src/front/glsl/builtins.rs:633 — naga/src/front/glsl/builtins.rs:633-642 | naga/src/front/glsl/builtins.rs:809-818 — both copies are in the same file, so extract the 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) naga/src/front/glsl/builtins.rs:857 — naga/src/front/glsl/builtins.rs:857-866 | naga/src/front/glsl/builtins.rs:885-894 — both copies are in the same file, so extract the 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) naga/src/front/glsl/builtins.rs:868 — naga/src/front/glsl/builtins.rs:868-877 | naga/src/front/glsl/builtins.rs:1196-1205 — both copies are in the same file, so extract the 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) naga/src/front/wgsl/parse/number.rs:253 — naga/src/front/wgsl/parse/number.rs:253-262 | naga/src/front/wgsl/parse/number.rs:272-281 — both copies are in the same file, so extract the 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) naga/src/proc/constant_evaluator.rs:2915 — naga/src/proc/constant_evaluator.rs:2915-2924 | naga/src/proc/constant_evaluator.rs:2978-2987 — both copies are in the same file, so extract the 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) naga/src/valid/expression.rs:1371 — naga/src/valid/expression.rs:1371-1380 | naga/src/valid/expression.rs:1391-1401 — both copies are in the same file, so extract the 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) naga/src/valid/function.rs:853 — naga/src/valid/function.rs:853-862 | naga/src/valid/function.rs:968-977 — both copies are in the same file, so extract the 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) naga/src/valid/interface.rs:457 — naga/src/valid/interface.rs:457-466 | naga/src/valid/interface.rs:468-477 — both copies are in the same file, so extract the 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) wgpu-core/src/pipeline.rs:575 — wgpu-core/src/pipeline.rs:575-584 | wgpu-core/src/pipeline.rs:1209-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.
  • Duplicated block (10 lines × 2) wgpu-hal/src/dx12/command.rs:1033 — wgpu-hal/src/dx12/command.rs:1033-1042 | wgpu-hal/src/dx12/command.rs:1705-1714 — both copies are in the same file, so extract the 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) wgpu-info/src/human.rs:320 — wgpu-info/src/human.rs:320-329 | wgpu-info/src/human.rs:349-358 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) wgpu/src/backend/webgpu.rs:2627 — wgpu/src/backend/webgpu.rs:2627-2636 | wgpu/src/backend/webgpu.rs:4533-4542 — both copies are in the same file, so extract the 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) wgpu/src/backend/webgpu.rs:3851 — wgpu/src/backend/webgpu.rs:3851-3860 | wgpu/src/backend/webgpu.rs:4138-4147 — both copies are in the same file, so extract the 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) wgpu/src/backend/wgpu_core.rs:1279 — wgpu/src/backend/wgpu_core.rs:1279-1288 | wgpu/src/backend/wgpu_core.rs:1362-1371 — both copies are in the same file, so extract the 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) wgpu-core/src/pipeline.rs:309 — wgpu-core/src/pipeline.rs:309-318 | wgpu/src/backend/webgpu.rs:1977-1986 — 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) naga/src/back/hlsl/writer.rs:4619 — naga/src/back/hlsl/writer.rs:4619-4628 | naga/src/back/wgsl/writer.rs:1922-1933 — `naga/src/back/hlsl/writer.rs` and `naga/src/back/wgsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 18 separate duplicated blocks between them, totalling at least 185 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (10 lines × 2) naga/src/back/hlsl/help.rs:2187 — naga/src/back/hlsl/help.rs:2187-2196 | naga/src/back/hlsl/help.rs:2200-2211 — both copies are in the same file, so extract the 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) naga/src/back/glsl/writer.rs:4004 — naga/src/back/glsl/writer.rs:4004-4013 | naga/src/back/glsl/writer.rs:4054-4063 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D3 · God Classes · ClassTooLong · ×23
  • ClassTooLong: Device wgpu-core/src/device/resource.rs:235 — ClassTooLong — 3633 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 102 methods, 6 blocks, lines 235-5961. The bar is 400 significant lines; this is 3233 over it, 9.08× 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: Lowerer naga/src/front/wgsl/lower/mod.rs:1280 — ClassTooLong — 2559 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 37 methods, 2 blocks, lines 1280-5092. The bar is 400 significant lines; this is 2159 over it, 6.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.
  • ClassTooLong: ConstantEvaluator naga/src/proc/constant_evaluator.rs:683 — ClassTooLong — 1979 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 43 methods, 2 blocks, lines 683-3816. The bar is 400 significant lines; this is 1579 over it, 4.95× 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: Frontend naga/src/front/spv/mod.rs:612 — ClassTooLong — 1781 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 69 methods, 2 blocks, lines 612-3222. The bar is 400 significant lines; this is 1381 over it, 4.45× 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: Writer naga/src/back/wgsl/writer.rs:82 — ClassTooLong — 1363 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 24 methods, 2 blocks, lines 82-2141. The bar is 400 significant lines; this is 963 over it, 3.41× 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: TextureFormat wgpu-types/src/texture/format.rs:128 — ClassTooLong — 1218 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 29 methods, 4 blocks, lines 128-1937. The bar is 400 significant lines; this is 818 over it, 3.05× 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: Player player/src/lib.rs:28 — ClassTooLong — 1066 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 39 methods, 3 blocks, lines 28-1358. The bar is 400 significant lines; this is 666 over it, 2.67× 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: Queue wgpu-core/src/device/queue.rs:48 — ClassTooLong — 1025 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 30 methods, 4 blocks, lines 48-2235. The bar is 400 significant lines; this is 625 over it, 2.56× 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: Error naga/src/front/wgsl/error.rs:335 — ClassTooLong — 1006 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 1 methods, 3 blocks, lines 335-1750. The bar is 400 significant lines; this is 606 over it, 2.52× 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: Context naga/src/front/glsl/context.rs:48 — ClassTooLong — 939 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 32 methods, 3 blocks, lines 48-1531. The bar is 400 significant lines; this is 539 over it, 2.35× 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: RenderPass wgpu-core/src/command/render.rs:298 — ClassTooLong — 724 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 66 methods, 6 blocks, lines 298-4548. The bar is 400 significant lines; this is 324 over it, 1.81× 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: WebDevice wgpu/src/backend/webgpu.rs:1237 — ClassTooLong — 654 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 2 methods, 4 blocks, lines 1237-2901. The bar is 400 significant lines; this is 254 over it, 1.64× 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: FunctionInfo naga/src/valid/analyzer.rs:240 — ClassTooLong — 623 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 10 methods, 5 blocks, lines 240-1235. The bar is 400 significant lines; this is 223 over it, 1.56× 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: GPUDevice deno_webgpu/device.rs:47 — ClassTooLong — 603 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 29 methods, 6 blocks, lines 47-913. The bar is 400 significant lines; this is 203 over it, 1.51× 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: Interface wgpu-core/src/validation.rs:376 — ClassTooLong — 598 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 5 methods, 2 blocks, lines 376-2135. The bar is 400 significant lines; this is 198 over it, 1.50× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: CoreDevice wgpu/src/backend/wgpu_core.rs:219 — ClassTooLong — 540 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 6 methods, 4 blocks, lines 219-1620. The bar is 400 significant lines; this is 140 over it, 1.35× 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: RenderBundleEncoder wgpu-core/src/command/bundle.rs:160 — ClassTooLong — 518 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 30 methods, 2 blocks, lines 160-945. The bar is 400 significant lines; this is 118 over it, 1.30× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: VaryingContext naga/src/valid/interface.rs:219 — ClassTooLong — 507 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 2 methods, 2 blocks, lines 219-917. The bar is 400 significant lines; this is 107 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.
  • ClassTooLong: RenderPassInfo wgpu-core/src/command/render.rs:1123 — ClassTooLong — 481 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 3 methods, 2 blocks, lines 1123-1871. The bar is 400 significant lines; this is 81 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.
  • ClassTooLong: Buffer wgpu-core/src/resource.rs:527 — ClassTooLong — 471 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 18 methods, 4 blocks, lines 527-1325. The bar is 400 significant lines; this is 71 over it, 1.18× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Texture wgpu-core/src/resource.rs:1654 — ClassTooLong — 469 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 14 methods, 7 blocks, lines 1654-2545. The bar is 400 significant lines; this is 69 over it, 1.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ResolveContext naga/src/proc/typifier.rs:220 — ClassTooLong — 443 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 2 methods, 2 blocks, lines 220-826. The bar is 400 significant lines; this is 43 over it, 1.11× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Limits wgpu-types/src/limits.rs:146 — ClassTooLong — 418 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 15 methods, 3 blocks, lines 146-1098. The bar is 400 significant lines; this is 18 over it, 1.05× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D4 · Code Duplication · Duplicated block (8 lines × 2) · ×23
  • Duplicated block (8 lines × 2) naga/src/back/dot/mod.rs:221 — naga/src/back/dot/mod.rs:221-228 | naga/src/back/dot/mod.rs:266-273 — both copies are in the same file, so extract the 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) naga/src/back/hlsl/help.rs:403 — naga/src/back/hlsl/help.rs:403-410 | naga/src/back/hlsl/help.rs:530-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.
  • Duplicated block (8 lines × 2) naga/src/back/msl/writer.rs:4320 — naga/src/back/msl/writer.rs:4320-4327 | naga/src/back/msl/writer.rs:4378-4385 — both copies are in the same file, so extract the 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) naga/src/back/spv/block.rs:1724 — naga/src/back/spv/block.rs:1724-1731 | naga/src/back/spv/block.rs:1762-1769 — both copies are in the same file, so extract the 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) naga/src/front/spv/mod.rs:2260 — naga/src/front/spv/mod.rs:2260-2267 | naga/src/front/spv/mod.rs:2315-2322 — both copies are in the same file, so extract the 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) naga/src/front/wgsl/error.rs:100 — naga/src/front/wgsl/error.rs:100-107 | naga/src/span.rs:298-305 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8 lines × 2) naga/src/front/wgsl/error.rs:120 — naga/src/front/wgsl/error.rs:120-127 | naga/src/span.rs:323-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.
  • Duplicated block (8 lines × 2) naga/src/front/wgsl/lower/mod.rs:3766 — naga/src/front/wgsl/lower/mod.rs:3766-3773 | naga/src/front/wgsl/lower/mod.rs:3780-3787 — both copies are in the same file, so extract the 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) naga/src/proc/constant_evaluator.rs:2930 — naga/src/proc/constant_evaluator.rs:2930-2937 | naga/src/proc/constant_evaluator.rs:2993-3000 — both copies are in the same file, so extract the 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) naga/src/proc/constant_evaluator.rs:2957 — naga/src/proc/constant_evaluator.rs:2957-2964 | naga/src/proc/constant_evaluator.rs:3017-3024 — both copies are in the same file, so extract the 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) wgpu-core/src/command/mod.rs:755 — wgpu-core/src/command/mod.rs:755-762 | wgpu-core/src/command/mod.rs:769-776 — both copies are in the same file, so extract the 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) wgpu-core/src/command/query.rs:361 — wgpu-core/src/command/query.rs:361-368 | wgpu-core/src/command/query.rs:419-426 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) wgpu-core/src/command/ray_tracing.rs:765 — wgpu-core/src/command/ray_tracing.rs:765-772 | wgpu-core/src/command/ray_tracing.rs:852-859 — both copies are in the same file, so extract the 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) wgpu-core/src/command/ray_tracing.rs:935 — wgpu-core/src/command/ray_tracing.rs:935-942 | wgpu-core/src/command/ray_tracing.rs:1064-1071 — both copies are in the same file, so extract the 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) wgpu-hal/src/auxil/dxgi/dxgi_lib.rs:48 — wgpu-hal/src/auxil/dxgi/dxgi_lib.rs:48-55 | wgpu-hal/src/auxil/dxgi/dxgi_lib.rs:96-103 — both copies are in the same file, so extract the 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) wgpu-hal/src/vulkan/device.rs:2245 — wgpu-hal/src/vulkan/device.rs:2245-2252 | wgpu-hal/src/vulkan/device.rs:2328-2335 — both copies are in the same file, so extract the 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) wgpu/src/backend/webgpu.rs:1082 — wgpu/src/backend/webgpu.rs:1082-1089 | wgpu/src/backend/webgpu.rs:1090-1097 — both copies are in the same file, so extract the 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) wgpu/src/api/pipeline_cache.rs:78 — wgpu/src/api/pipeline_cache.rs:78-95 | wgpu/src/api/render_bundle.rs:19-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.
  • Duplicated block (8 lines × 2) wgpu-core/src/pipeline.rs:337 — wgpu-core/src/pipeline.rs:337-344 | wgpu/src/backend/webgpu.rs:2008-2015 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8 lines × 2) wgpu/src/api/render_bundle_encoder.rs:95 — wgpu/src/api/render_bundle_encoder.rs:95-102 | wgpu/src/api/render_pass.rs:107-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 (8 lines × 2) naga/src/back/hlsl/help.rs:403 — naga/src/back/hlsl/help.rs:403-410 | naga/src/back/msl/writer.rs:6592-6600 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8 lines × 2) naga/src/back/msl/writer.rs:1343 — naga/src/back/msl/writer.rs:1343-1350 | naga/src/back/msl/writer.rs:3098-3105 — both copies are in the same file, so extract the 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) naga/src/back/hlsl/storage.rs:198 — naga/src/back/hlsl/storage.rs:198-205 | naga/src/back/hlsl/storage.rs:218-225 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D3 · God Classes · TooManyMethods · ×22
  • TooManyMethods: Global wgpu-core-remote/src/global/mod.rs:40 — TooManyMethods — 197 methods, declared across 8 files: global/device.rs (71), global/mod.rs (42), global/render_pass.rs (26), global/compute_pass.rs (15), +4 more file(s). The bar is 30 methods; this is 167 over it, 6.57× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. 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: Instruction naga/src/back/spv/mod.rs:153 — TooManyMethods — 109 methods, declared across 2 files: spv/instructions.rs (102), spv/layout.rs (7). The bar is 30 methods; this is 79 over it, 3.63× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. 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: Device wgpu-core/src/device/resource.rs:235 — TooManyMethods — 102 methods, declared across 4 files: device/resource.rs (88), src/error.rs (8), device/ray_tracing.rs (4), src/as_hal.rs (2). The bar is 30 methods; this is 72 over it, 3.40× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. 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: Writer naga/src/back/hlsl/mod.rs:746 — TooManyMethods — 98 methods, declared across 5 files: hlsl/writer.rs (42), hlsl/help.rs (34), hlsl/ray.rs (11), hlsl/storage.rs (6), +1 more file(s). The bar is 30 methods; this is 68 over it, 3.27× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. 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: Writer naga/src/back/spv/mod.rs:920 — TooManyMethods — 97 methods, declared across 6 files: spv/writer.rs (74), spv/mesh_shader.rs (8), ray/query.rs (7), ray/mod.rs (4), +2 more file(s). The bar is 30 methods; this is 67 over it, 3.23× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. 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: Writer naga/src/back/msl/writer.rs:545 — 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: Frontend naga/src/front/spv/mod.rs:612 — TooManyMethods — 69 methods, declared across 4 files: spv/mod.rs (58), spv/image.rs (7), spv/function.rs (3), spv/next_block.rs (1). The bar is 30 methods; this is 39 over it, 2.30× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. 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: RenderPass wgpu-core/src/command/render.rs:298 — TooManyMethods — 66 methods. The bar is 30 methods; this is 36 over it, 2.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: BlockContext naga/src/back/spv/mod.rs:825 — TooManyMethods — 57 methods, declared across 7 files: spv/block.rs (22), spv/image.rs (12), spv/index.rs (9), spv/mod.rs (8), +3 more file(s). The bar is 30 methods; this is 27 over it, 1.90× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. 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: Writer naga/src/back/glsl/writer.rs:5 — TooManyMethods — 48 methods, declared across 4 files: glsl/writer.rs (38), msl/ray.rs (5), glsl/features.rs (3), msl/mesh_shader.rs (2). The bar is 30 methods; this is 18 over it, 1.60× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. 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: Device wgpu/src/api/device.rs:22 — TooManyMethods — 46 methods. The bar is 30 methods; this is 16 over it, 1.53× 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: ConstantEvaluator naga/src/proc/constant_evaluator.rs:683 — 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: Validator naga/src/valid/mod.rs:381 — TooManyMethods — 43 methods, declared across 6 files: valid/handles.rs (12), valid/function.rs (9), valid/mod.rs (9), valid/expression.rs (6), +2 more file(s). The bar is 30 methods; this is 13 over it, 1.43× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. 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: CommandEncoder wgpu-core/src/command/mod.rs:510 — TooManyMethods — 43 methods, declared across 9 files: command/mod.rs (16), command/transfer.rs (8), command/clear.rs (4), command/query.rs (4), +5 more file(s). The bar is 30 methods; this is 13 over it, 1.43× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. 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: ParsingContext naga/src/front/glsl/parser.rs:24 — TooManyMethods — 40 methods, declared across 5 files: glsl/parser.rs (12), parser/types.rs (9), parser/expressions.rs (8), parser/declarations.rs (6), +1 more file(s). The bar is 30 methods; this is 10 over it, 1.33× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. 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: Parser naga/src/front/wgsl/parse/mod.rs:301 — TooManyMethods — 39 methods. The bar is 30 methods; this is 9 over it, 1.30× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Player player/src/lib.rs:28 — TooManyMethods — 39 methods. The bar is 30 methods; this is 9 over it, 1.30× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Lowerer naga/src/front/wgsl/lower/mod.rs:1280 — TooManyMethods — 37 methods, declared across 2 files: lower/mod.rs (36), lower/construction.rs (1). The bar is 30 methods; this is 7 over it, 1.23× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. 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: ExpressionContext naga/src/front/wgsl/lower/mod.rs:369 — TooManyMethods — 34 methods, declared across 2 files: lower/mod.rs (25), lower/conversion.rs (9). The bar is 30 methods; this is 4 over it, 1.13× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. 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: Context naga/src/front/glsl/context.rs:48 — TooManyMethods — 32 methods, declared across 3 files: glsl/context.rs (25), glsl/types.rs (6), glsl/functions.rs (1). The bar is 30 methods; this is 2 over it, 1.07× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. 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: TypeInner naga/src/ir/mod.rs:851 — TooManyMethods — 32 methods, declared across 7 files: proc/type_methods.rs (20), hlsl/conv.rs (3), proc/index.rs (3), lower/conversion.rs (2), +3 more file(s). The bar is 30 methods; this is 2 over it, 1.07× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. 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: RenderPass wgpu/src/api/render_pass.rs:28 — TooManyMethods — 32 methods. The bar is 30 methods; this is 2 over it, 1.07× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D4 · Code Duplication · Duplicated block (5 lines × 2) · ×22
  • Duplicated block (5 lines × 2) naga/src/back/glsl/writer.rs:760 — naga/src/back/glsl/writer.rs:760-765 | naga/src/back/glsl/writer.rs:828-832 — both copies are in the same file, so extract the 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) naga/src/back/glsl/writer.rs:1767 — naga/src/back/glsl/writer.rs:1767-1771 | naga/src/back/hlsl/writer.rs:2154-2158 — `naga/src/back/glsl/writer.rs` and `naga/src/back/hlsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 86 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (5 lines × 2) naga/src/back/glsl/writer.rs:1847 — naga/src/back/glsl/writer.rs:1847-1851 | naga/src/back/hlsl/writer.rs:2608-2612 — `naga/src/back/glsl/writer.rs` and `naga/src/back/hlsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 86 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (5 lines × 2) naga/src/back/hlsl/writer.rs:2334 — naga/src/back/hlsl/writer.rs:2334-2338 | naga/src/back/hlsl/writer.rs:4808-4812 — both copies are in the same file, so extract the 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) naga/src/back/msl/writer.rs:2853 — naga/src/back/msl/writer.rs:2853-2857 | naga/src/back/msl/writer.rs:2872-2876 — both copies are in the same file, so extract the 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) naga/src/front/spv/next_block.rs:1519 — naga/src/front/spv/next_block.rs:1519-1523 | naga/src/front/spv/next_block.rs:1526-1530 — both copies are in the same file, so extract the 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) naga/src/front/wgsl/error.rs:94 — naga/src/front/wgsl/error.rs:94-98 | naga/src/span.rs:292-296 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (5 lines × 2) naga/src/front/wgsl/lower/mod.rs:3670 — naga/src/front/wgsl/lower/mod.rs:3670-3674 | naga/src/front/wgsl/lower/mod.rs:3936-3940 — both copies are in the same file, so extract the 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) naga/src/front/wgsl/lower/mod.rs:4488 — naga/src/front/wgsl/lower/mod.rs:4488-4492 | naga/src/front/wgsl/lower/mod.rs:5075-5079 — both copies are in the same file, so extract the 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) naga/src/front/wgsl/parse/mod.rs:936 — naga/src/front/wgsl/parse/mod.rs:936-940 | naga/src/front/wgsl/parse/mod.rs:943-947 — both copies are in the same file, so extract the 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) naga/src/front/wgsl/parse/number.rs:438 — naga/src/front/wgsl/parse/number.rs:438-443 | naga/src/front/wgsl/parse/number.rs:497-501 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) naga/src/proc/constant_evaluator.rs:3279 — naga/src/proc/constant_evaluator.rs:3279-3283 | naga/src/proc/constant_evaluator.rs:3350-3354 — both copies are in the same file, so extract the 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) wgpu-core/src/pipeline.rs:569 — wgpu-core/src/pipeline.rs:569-573 | wgpu-core/src/pipeline.rs:1203-1207 — both copies are in the same file, so extract the 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) naga/src/back/hlsl/writer.rs:3619 — naga/src/back/hlsl/writer.rs:3619-3623 | naga/src/back/wgsl/writer.rs:1402-1406 — `naga/src/back/hlsl/writer.rs` and `naga/src/back/wgsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 18 separate duplicated blocks between them, totalling at least 185 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (5 lines × 2) wgpu/src/api/render_bundle_encoder.rs:74 — wgpu/src/api/render_bundle_encoder.rs:74-78 | wgpu/src/api/render_pass.rs:76-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.
  • Duplicated block (5 lines × 2) naga/src/back/hlsl/writer.rs:3519 — naga/src/back/hlsl/writer.rs:3519-3526 | naga/src/back/hlsl/writer.rs:3536-3540 — both copies are in the same file, so extract the 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) naga/src/back/hlsl/help.rs:337 — naga/src/back/hlsl/help.rs:337-341 | naga/src/back/hlsl/help.rs:432-439 — both copies are in the same file, so extract the 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) naga/src/back/msl/writer.rs:4163 — naga/src/back/msl/writer.rs:4163-4168 | naga/src/back/wgsl/writer.rs:870-874 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (5 lines × 2) naga/src/back/hlsl/help.rs:1421 — naga/src/back/hlsl/help.rs:1421-1425 | naga/src/back/hlsl/help.rs:1473-1477 — both copies are in the same file, so extract the 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) naga/src/back/msl/writer.rs:1454 — naga/src/back/msl/writer.rs:1454-1458 | naga/src/back/msl/writer.rs:1464-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.
  • Duplicated block (5 lines × 2) naga/src/back/hlsl/writer.rs:2651 — naga/src/back/hlsl/writer.rs:2651-2655 | naga/src/back/wgsl/writer.rs:845-849 — `naga/src/back/hlsl/writer.rs` and `naga/src/back/wgsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 18 separate duplicated blocks between them, totalling at least 185 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (5 lines × 2) naga/src/back/glsl/writer.rs:3128 — naga/src/back/glsl/writer.rs:3128-3132 | naga/src/back/glsl/writer.rs:3471-3475 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D2 · Cognitive Complexity · naga · ×21
  • naga::front::glsl::builtins::inject_standard_builtins (cognitive 135) naga/src/front/glsl/builtins.rs:462 — naga::front::glsl::builtins::inject_standard_builtins has cognitive complexity 135 (threshold 15). Drivers by points: match/switch 43 (97 pts), loops 13 (26 pts), if/else 8 (12 pts) (nesting depth added 71). 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.
  • naga::front::glsl::builtins::inject_builtin (cognitive 87) naga/src/front/glsl/builtins.rs:78 — naga::front::glsl::builtins::inject_builtin has cognitive complexity 87 (threshold 15). Drivers by points: if/else 29 (57 pts), boolean chains 16, match/switch 6 (12 pts), loops 1 (2 pts) (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • naga::front::glsl::builtins::inject_common_builtin (cognitive 80) naga/src/front/glsl/builtins.rs:1220 — naga::front::glsl::builtins::inject_common_builtin has cognitive complexity 80 (threshold 15). Drivers by points: match/switch 23 (55 pts), loops 10 (21 pts), if/else 1 (3 pts), boolean chains 1 (nesting depth added 45). 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.
  • naga::compact::compact (cognitive 78) naga/src/compact/mod.rs:68 — naga::compact::compact has cognitive complexity 78 (threshold 15). Drivers by points: if/else 35 (60 pts), loops 10 (15 pts), boolean chains 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.
  • naga::front::wgsl::parse::number::parse (cognitive 67) naga/src/front/wgsl/parse/number.rs:88 — naga::front::wgsl::parse::number::parse has cognitive complexity 67 (threshold 15). Drivers by points: if/else 22 (55 pts), match/switch 6 (9 pts), loops 2, boolean chains 1 (nesting depth added 36). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • naga::back::dot::write_function_expressions (cognitive 56) naga/src/back/dot/mod.rs:571 — naga::back::dot::write_function_expressions has cognitive complexity 56 (threshold 15). Drivers by points: if/else 15 (32 pts), match/switch 7 (18 pts), loops 3 (6 pts) (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • naga::common::wgsl::types::try_write_type_inner (cognitive 48) naga/src/common/wgsl/types.rs:194 — naga::common::wgsl::types::try_write_type_inner has cognitive complexity 48 (threshold 15). Drivers by points: if/else 23 (42 pts), match/switch 4 (6 pts) (nesting depth added 21). 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.
  • naga::front::wgsl::parse::lexer::consume_token (cognitive 48) naga/src/front/wgsl/parse/lexer.rs:279 — naga::front::wgsl::parse::lexer::consume_token has cognitive complexity 48 (threshold 15). Drivers by points: match/switch 16 (37 pts), if/else 2 (7 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 28). 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.
  • naga::front::glsl::builtins::inject_double_builtin (cognitive 46) naga/src/front/glsl/builtins.rs:1047 — naga::front::glsl::builtins::inject_double_builtin has cognitive complexity 46 (threshold 15). Drivers by points: match/switch 14 (36 pts), loops 5 (10 pts) (nesting depth added 27). 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.
  • naga::back::pipeline_constants::process_overrides (cognitive 41) naga/src/back/pipeline_constants.rs:71 — naga::back::pipeline_constants::process_overrides has cognitive complexity 41 (threshold 15). Drivers by points: if/else 12 (23 pts), loops 8 (11 pts), match/switch 2 (4 pts), boolean chains 3 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • naga::back::pipeline_constants::map_value_to_literal (cognitive 32) naga/src/back/pipeline_constants.rs:1035 — naga::back::pipeline_constants::map_value_to_literal has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (26 pts), boolean chains 5, match/switch 1 (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • naga::back::pipeline_constants::adjust_stmt (cognitive 31) naga/src/back/pipeline_constants.rs:721 — naga::back::pipeline_constants::adjust_stmt has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (16 pts), match/switch 5 (9 pts), loops 3 (6 pts) (nesting depth added 15). 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.
  • naga::valid::compose::validate_compose (cognitive 29) naga/src/valid/compose.rs:15 — naga::valid::compose::validate_compose has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 4 (8 pts), match/switch 2 (4 pts) (nesting depth added 16). 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.
  • naga::front::glsl::builtins::texture_args_generator (cognitive 27) naga/src/front/glsl/builtins.rs:2322 — naga::front::glsl::builtins::texture_args_generator has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 3 (6 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.
  • naga::back::pipeline_constants::adjust_expr (cognitive 24) naga/src/back/pipeline_constants.rs:488 — naga::back::pipeline_constants::adjust_expr has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (17 pts), match/switch 3 (5 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.
  • naga::front::wgsl::parse::number::parse_hex_float_parts (cognitive 24) naga/src/front/wgsl/parse/number.rs:436 — naga::front::wgsl::parse::number::parse_hex_float_parts has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (8 pts), match/switch 6 (8 pts), loops 4 (5 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.
  • naga::back::pipeline_constants::filter_emits_in_block (cognitive 23) naga/src/back/pipeline_constants.rs:962 — naga::back::pipeline_constants::filter_emits_in_block has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 3 (7 pts), match/switch 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.
  • naga::front::wgsl::parse::number::convert_hex_float (cognitive 23) naga/src/front/wgsl/parse/number.rs:560 — naga::front::wgsl::parse::number::convert_hex_float has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (21 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.
  • naga::front::glsl::offset::calculate_offset (cognitive 18) naga/src/front/glsl/offset.rs:43 — naga::front::glsl::offset::calculate_offset has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 2 (3 pts), loops 1 (2 pts) (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.
  • naga::front::glsl::types::parse_type (cognitive 18) naga/src/front/glsl/types.rs:9 — naga::front::glsl::types::parse_type has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 8 (15 pts), if/else 2 (3 pts) (nesting depth added 8). Of this number, 14 points are the body's own statements and 4 belong to 2 function items inside it that branch. 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.
  • naga::proc::index::oob_local_types (cognitive 16) naga/src/proc/index.rs:413 — naga::proc::index::oob_local_types has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 2 (4 pts), match/switch 1 (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.
D1 · Cyclomatic Complexity · Device · ×19
  • Device::create_render_pipeline_or_error_inner (cyclomatic 119) wgpu-core/src/device/resource.rs:4731 — Device::create_render_pipeline_or_error_inner has cyclomatic complexity 119 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Device::create_render_pipeline (cyclomatic 46) wgpu-hal/src/metal/device.rs:1424 — Device::create_render_pipeline 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.
  • Device::validate_texture_descriptor_inner (cyclomatic 41) wgpu-core/src/device/resource.rs:1823 — Device::validate_texture_descriptor_inner 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.
  • Device::create_pipeline_layout (cyclomatic 38) wgpu-hal/src/dx12/device.rs:970 — Device::create_pipeline_layout 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.
  • Device::create_bind_group_layout_impl (cyclomatic 34) wgpu-core/src/device/resource.rs:3067 — Device::create_bind_group_layout_impl 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.
  • Device::load_shader (cyclomatic 29) wgpu-hal/src/metal/device.rs:163 — Device::load_shader has cyclomatic complexity 29 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: wgpu_hal::metal::device::convert_vertex_format_to_naga (cyclomatic 43) 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 function is counted neither in this dimension's figures nor in its score.
  • Device::create_buffer_inner (cyclomatic 27) wgpu-core/src/device/resource.rs:1233 — Device::create_buffer_inner 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.
  • Device::create_render_pipeline (cyclomatic 26) wgpu-hal/src/dx12/device.rs:1997 — Device::create_render_pipeline 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.
  • Device::create_pipeline_layout (cyclomatic 26) wgpu-hal/src/metal/device.rs:901 — Device::create_pipeline_layout has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: wgpu_hal::metal::device::convert_vertex_format_to_naga (cyclomatic 43) 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 function is counted neither in this dimension's figures nor in its score.
  • Device::create_render_pipeline (cyclomatic 26) wgpu-hal/src/vulkan/device.rs:1986 — Device::create_render_pipeline 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.
  • Device::texture_use_parameters (cyclomatic 23) wgpu-core/src/device/resource.rs:4123 — Device::texture_use_parameters 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.
  • Device::create_bind_group (cyclomatic 23) wgpu-hal/src/dx12/device.rs:1591 — Device::create_bind_group has cyclomatic complexity 23 (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.
  • Device::create_bind_group (cyclomatic 23) wgpu-hal/src/metal/device.rs:1088 — Device::create_bind_group 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. This is NOT this file's highest cyclomatic complexity: wgpu_hal::metal::device::convert_vertex_format_to_naga (cyclomatic 43) 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 function is counted neither in this dimension's figures nor in its score.
  • Device::create_bind_group_inner (cyclomatic 20) wgpu-core/src/device/resource.rs:3820 — Device::create_bind_group_inner 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.
  • Device::create_buffer (cyclomatic 20) wgpu-hal/src/gles/device.rs:684 — Device::create_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.
  • Device::create_texture (cyclomatic 20) wgpu-hal/src/gles/device.rs:943 — Device::create_texture 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.
  • Device::maintain (cyclomatic 18) wgpu-core/src/device/resource.rs:1019 — Device::maintain 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.
  • Device::create_program (cyclomatic 18) wgpu-hal/src/gles/device.rs:530 — Device::create_program 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.
  • Device::create_bind_group_layout (cyclomatic 18) wgpu-hal/src/vulkan/device.rs:1467 — Device::create_bind_group_layout has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · naga · ×18
  • naga::front::glsl::builtins::inject_standard_builtins (cyclomatic 177) naga/src/front/glsl/builtins.rs:462 — naga::front::glsl::builtins::inject_standard_builtins has cyclomatic complexity 177 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • naga::front::glsl::builtins::inject_common_builtin (cyclomatic 91) naga/src/front/glsl/builtins.rs:1220 — naga::front::glsl::builtins::inject_common_builtin has cyclomatic complexity 91 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • naga::front::wgsl::parse::conv::map_predeclared_type (cyclomatic 91) naga/src/front/wgsl/parse/conv.rs:448 — naga::front::wgsl::parse::conv::map_predeclared_type has cyclomatic complexity 91 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • naga::front::glsl::builtins::inject_builtin (cyclomatic 70) naga/src/front/glsl/builtins.rs:78 — naga::front::glsl::builtins::inject_builtin has cyclomatic complexity 70 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • naga::back::dot::write_function_expressions (cyclomatic 60) naga/src/back/dot/mod.rs:571 — naga::back::dot::write_function_expressions has cyclomatic complexity 60 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • naga::front::wgsl::parse::lexer::consume_token (cyclomatic 47) naga/src/front/wgsl/parse/lexer.rs:279 — naga::front::wgsl::parse::lexer::consume_token has cyclomatic complexity 47 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • naga::compact::compact (cyclomatic 44) naga/src/compact/mod.rs:68 — naga::compact::compact 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.
  • naga::front::glsl::builtins::inject_double_builtin (cyclomatic 44) naga/src/front/glsl/builtins.rs:1047 — naga::front::glsl::builtins::inject_double_builtin has cyclomatic complexity 44 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • naga::back::pipeline_constants::adjust_stmt (cyclomatic 39) naga/src/back/pipeline_constants.rs:721 — naga::back::pipeline_constants::adjust_stmt has cyclomatic complexity 39 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • naga::front::glsl::types::parse_type (cyclomatic 39) naga/src/front/glsl/types.rs:9 — naga::front::glsl::types::parse_type has cyclomatic complexity 39 (threshold 15). Of this number, 30 points are the body's own statements and 9 belong to 2 function items inside it that branch. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • naga::common::wgsl::types::try_write_type_inner (cyclomatic 38) naga/src/common/wgsl/types.rs:194 — naga::common::wgsl::types::try_write_type_inner 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.
  • naga::back::pipeline_constants::adjust_expr (cyclomatic 36) naga/src/back/pipeline_constants.rs:488 — naga::back::pipeline_constants::adjust_expr has cyclomatic complexity 36 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • naga::back::glsl::conv::glsl_built_in (cyclomatic 33) naga/src/back/glsl/conv.rs:69 — naga::back::glsl::conv::glsl_built_in has cyclomatic complexity 33 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: naga::back::glsl::conv::glsl_storage_format (cyclomatic 41) 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 function is counted neither in this dimension's figures nor in its score.
  • naga::front::wgsl::parse::number::parse_hex_float_parts (cyclomatic 30) naga/src/front/wgsl/parse/number.rs:436 — naga::front::wgsl::parse::number::parse_hex_float_parts has cyclomatic complexity 30 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • naga::back::pipeline_constants::map_value_to_literal (cyclomatic 28) naga/src/back/pipeline_constants.rs:1035 — naga::back::pipeline_constants::map_value_to_literal 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.
  • naga::front::wgsl::parse::number::parse (cyclomatic 26) naga/src/front/wgsl/parse/number.rs:88 — naga::front::wgsl::parse::number::parse 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.
  • naga::back::pipeline_constants::process_overrides (cyclomatic 25) naga/src/back/pipeline_constants.rs:71 — naga::back::pipeline_constants::process_overrides 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.
  • naga::valid::compose::validate_compose (cyclomatic 18) naga/src/valid/compose.rs:15 — naga::valid::compose::validate_compose 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.
D2 · Cognitive Complexity · Frontend · ×18
  • Frontend::next_block (cognitive 350) naga/src/front/spv/next_block.rs:22 — Frontend::next_block has cognitive complexity 350 (threshold 15). Drivers by points: if/else 72 (168 pts), match/switch 36 (123 pts), loops 18 (56 pts), boolean chains 3 (nesting depth added 221). Of this number, 349 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Frontend::process_entry_point (cognitive 76) naga/src/front/spv/function.rs:320 — Frontend::process_entry_point has cognitive complexity 76 (threshold 15). Drivers by points: if/else 15 (58 pts), loops 6 (12 pts), match/switch 3 (6 pts) (nesting depth added 52). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • Frontend::function_call (cognitive 68) naga/src/front/glsl/functions.rs:515 — Frontend::function_call has cognitive complexity 68 (threshold 15). Drivers by points: if/else 16 (37 pts), match/switch 7 (20 pts), loops 5 (7 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.
  • Frontend::parse_image_sample (cognitive 55) naga/src/front/spv/image.rs:490 — Frontend::parse_image_sample has cognitive complexity 55 (threshold 15). Drivers by points: if/else 17 (27 pts), match/switch 13 (23 pts), loops 2 (4 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.
  • Frontend::add_global_var (cognitive 41) naga/src/front/glsl/variables.rs:415 — Frontend::add_global_var has cognitive complexity 41 (threshold 15). Drivers by points: if/else 8 (23 pts), match/switch 7 (18 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Frontend::parse_global_variable (cognitive 38) naga/src/front/spv/mod.rs:2951 — Frontend::parse_global_variable has cognitive complexity 38 (threshold 15). Drivers by points: match/switch 7 (18 pts), if/else 10 (15 pts), loops 1 (4 pts), boolean chains 1 (nesting depth added 19). 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.
  • Frontend::field_selection (cognitive 34) naga/src/front/glsl/variables.rs:244 — Frontend::field_selection has cognitive complexity 34 (threshold 15). Drivers by points: if/else 6 (16 pts), match/switch 5 (11 pts), loops 2 (7 pts) (nesting depth added 21). 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.
  • Frontend::parse_function (cognitive 31) naga/src/front/spv/function.rs:28 — Frontend::parse_function has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 5 (9 pts), match/switch 3 (6 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.
  • Frontend::handle_directive (cognitive 30) naga/src/front/glsl/parser.rs:248 — Frontend::handle_directive has cognitive complexity 30 (threshold 15). Drivers by points: match/switch 9 (20 pts), if/else 4 (10 pts) (nesting depth added 17). 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.
  • Frontend::parse (cognitive 26) naga/src/front/spv/mod.rs:1714 — Frontend::parse has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 7 (10 pts), match/switch 2 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Frontend::matrix_one_arg (cognitive 24) naga/src/front/glsl/functions.rs:211 — Frontend::matrix_one_arg has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (11 pts), match/switch 4 (9 pts), loops 2 (4 pts) (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Frontend::constructor_many (cognitive 23) naga/src/front/glsl/functions.rs:414 — Frontend::constructor_many has cognitive complexity 23 (threshold 15). Drivers by points: loops 5 (12 pts), if/else 3 (7 pts), match/switch 2 (4 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.
  • Frontend::process_lhs_argument (cognitive 22) naga/src/front/glsl/functions.rs:873 — Frontend::process_lhs_argument has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (16 pts), loops 1 (3 pts), match/switch 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.
  • Frontend::patch_statements (cognitive 22) naga/src/front/spv/mod.rs:1584 — Frontend::patch_statements has cognitive complexity 22 (threshold 15). Drivers by points: match/switch 3 (10 pts), loops 3 (7 pts), if/else 1 (5 pts) (nesting depth added 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Frontend::coordinate_components (cognitive 20) naga/src/front/glsl/builtins.rs:2113 — Frontend::coordinate_components has cognitive complexity 20 (threshold 15). Drivers by points: match/switch 5 (10 pts), if/else 6 (9 pts), boolean chains 1 (nesting depth added 8). 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.
  • Frontend::parse_execution_mode (cognitive 19) naga/src/front/spv/mod.rs:1954 — Frontend::parse_execution_mode has cognitive complexity 19 (threshold 15). Drivers by points: if/else 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.
  • Frontend::constructor_single (cognitive 17) naga/src/front/glsl/functions.rs:61 — Frontend::constructor_single has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 3, boolean chains 1 (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Frontend::parse_image_load (cognitive 16) naga/src/front/spv/image.rs:366 — Frontend::parse_image_load has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (7 pts), match/switch 3 (5 pts), loops 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.
D4 · Code Duplication · Duplicated block (12 lines × 2) · ×16
  • Duplicated block (12 lines × 2) deno_webgpu/buffer.rs:204 — deno_webgpu/buffer.rs:204-215 | deno_webgpu/queue.rs:86-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 (12 lines × 2) naga/src/back/glsl/writer.rs:2469 — naga/src/back/glsl/writer.rs:2469-2480 | naga/src/back/wgsl/writer.rs:1569-1580 — `naga/src/back/glsl/writer.rs` and `naga/src/back/wgsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 135 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) naga/src/back/wgsl/writer.rs:1623 — naga/src/back/wgsl/writer.rs:1623-1634 | naga/src/back/wgsl/writer.rs:1697-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.
  • Duplicated block (12 lines × 2) naga/src/common/diagnostic_debug.rs:74 — naga/src/common/diagnostic_debug.rs:74-85 | naga/src/common/diagnostic_display.rs:112-123 — before extracting anything, compare `naga/src/common/diagnostic_debug.rs` and `naga/src/common/diagnostic_display.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 36 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 lines × 2) naga/src/front/glsl/builtins.rs:1305 — naga/src/front/glsl/builtins.rs:1305-1316 | naga/src/front/glsl/builtins.rs:1416-1427 — both copies are in the same file, so extract the 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) naga/src/front/glsl/functions.rs:1076 — naga/src/front/glsl/functions.rs:1076-1087 | naga/src/front/glsl/functions.rs:1158-1169 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) naga/src/front/wgsl/lower/mod.rs:1729 — naga/src/front/wgsl/lower/mod.rs:1729-1740 | naga/src/front/wgsl/lower/mod.rs:1744-1755 — both copies are in the same file, so extract the 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) naga/src/valid/function.rs:712 — naga/src/valid/function.rs:712-723 | naga/src/valid/function.rs:775-786 — both copies are in the same file, so extract the 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) player/src/lib.rs:1014 — player/src/lib.rs:1014-1025 | player/src/lib.rs:1169-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.
  • Duplicated block (12 lines × 2) wgpu-core/src/device/resource.rs:545 — wgpu-core/src/device/resource.rs:545-556 | wgpu-core/src/device/resource.rs:564-575 — both copies are in the same file, so extract the 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) wgpu-core/src/indirect_validation/dispatch.rs:150 — wgpu-core/src/indirect_validation/dispatch.rs:150-161 | wgpu-core/src/indirect_validation/dispatch.rs:176-187 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) wgpu-core/src/track/texture.rs:1231 — wgpu-core/src/track/texture.rs:1231-1242 | wgpu-core/src/track/texture.rs:1483-1494 — both copies are in the same file, so extract the 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) wgpu-hal/src/metal/command.rs:400 — wgpu-hal/src/metal/command.rs:400-411 | wgpu-hal/src/metal/command.rs:415-426 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) wgpu-types/src/write_only.rs:539 — wgpu-types/src/write_only.rs:539-550 | wgpu-types/src/write_only.rs:552-563 — both copies are in the same file, so extract the 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) wgpu/src/api/command_encoder.rs:436 — wgpu/src/api/command_encoder.rs:436-447 | wgpu/src/api/compute_pass.rs:139-150 — 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) wgpu/src/api/render_bundle_encoder.rs:122 — wgpu/src/api/render_bundle_encoder.rs:122-133 | wgpu/src/api/render_pass.rs:136-147 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D2 · Cognitive Complexity · CommandEncoder · ×15
  • CommandEncoder::begin_render_pass_inner::fill_arc_desc (cognitive 74) wgpu-core/src/command/render.rs:1887 — CommandEncoder::begin_render_pass_inner::fill_arc_desc has cognitive complexity 74 (threshold 15). Drivers by points: if/else 28 (61 pts), match/switch 2 (8 pts), boolean chains 4, loops 1 (nesting depth added 39). 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.
  • CommandEncoder::begin_render_pass (cognitive 57) wgpu-hal/src/gles/command.rs:498 — CommandEncoder::begin_render_pass has cognitive complexity 57 (threshold 15). Drivers by points: if/else 18 (41 pts), match/switch 4 (8 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CommandEncoder::begin_render_pass (cognitive 51) wgpu-hal/src/metal/command.rs:895 — CommandEncoder::begin_render_pass has cognitive complexity 51 (threshold 15). Drivers by points: if/else 28 (47 pts), loops 3 (4 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.
  • CommandEncoder::begin_render_pass (cognitive 39) wgpu-hal/src/dx12/command.rs:1026 — CommandEncoder::begin_render_pass has cognitive complexity 39 (threshold 15). Drivers by points: if/else 19 (33 pts), boolean chains 4, loops 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.
  • CommandEncoder::push_barrier (cognitive 34) wgpu-hal/src/dx12/command.rs:90 — CommandEncoder::push_barrier has cognitive complexity 34 (threshold 15). Drivers by points: loops 3 (12 pts), match/switch 3 (12 pts), if/else 7 (10 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.
  • CommandEncoder::set_render_pipeline (cognitive 33) wgpu-hal/src/gles/command.rs:872 — CommandEncoder::set_render_pipeline has cognitive complexity 33 (threshold 15). Drivers by points: if/else 16 (21 pts), loops 6 (11 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • CommandEncoder::transition_textures (cognitive 28) wgpu-hal/src/dx12/command.rs:642 — CommandEncoder::transition_textures has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (26 pts), boolean chains 1, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CommandEncoder::set_render_pipeline (cognitive 25) wgpu-hal/src/metal/command.rs:1290 — CommandEncoder::set_render_pipeline has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (17 pts), loops 2 (4 pts), match/switch 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.
  • CommandEncoder::rebind_vertex_data (cognitive 24) wgpu-hal/src/gles/command.rs:134 — CommandEncoder::rebind_vertex_data has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (11 pts), match/switch 3 (9 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.
  • CommandEncoder::build_acceleration_structures (cognitive 24) wgpu-hal/src/vulkan/command.rs:566 — CommandEncoder::build_acceleration_structures has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 4 (8 pts), match/switch 3 (5 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CommandEncoder::update_bind_group_state (cognitive 21) wgpu-hal/src/metal/command.rs:311 — CommandEncoder::update_bind_group_state has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 4 (6 pts), match/switch 5 (6 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.
  • CommandEncoder::encode_commands (cognitive 18) wgpu-core/src/command/mod.rs:1085 — CommandEncoder::encode_commands has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 4 (11 pts), if/else 5 (6 pts), loops 1 (nesting depth added 8). 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.
  • CommandEncoder::update_root_elements (cognitive 18) wgpu-hal/src/dx12/command.rs:271 — CommandEncoder::update_root_elements has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 7 (11 pts), loops 3 (7 pts) (nesting depth added 8). 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.
  • CommandEncoder::set_immediates (cognitive 17) wgpu-hal/src/metal/command.rs:1201 — CommandEncoder::set_immediates has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (17 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.
  • CommandEncoder::begin_render_pass (cognitive 16) wgpu-hal/src/vulkan/command.rs:824 — CommandEncoder::begin_render_pass has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (15 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.
D17 · Explicit Debt · HackComment · ×14
  • HackComment wgpu-hal/src/gles/mod.rs:521 — // HACK: detect a cube map; forces cube compatible textures to be cube textures — 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 wgpu-core/src/instance.rs:710 — // HACK: We must take ownership of the field here, without being able to pass it into — 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 naga/tests/naga/snapshots.rs:377 — // HACK escape CR/LF if source code is in side. — 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 naga/src/valid/type.rs:753 — // HACK: this could be nicer. We want to allow some structures — 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 naga/src/front/spv/mod.rs:2401 — // HACK if the underlying type is an image or a sampler, let's assume — 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 naga/src/front/spv/mod.rs:2482 — // HACK same case as in `parse_type_array()` — 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 naga/src/front/spv/next_block.rs:245 — // HACK `OpAccessChain` and `OpInBoundsAccessChain` — 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 naga/src/front/spv/next_block.rs:1977 — // HACK(eddyb) Naga doesn't seem to have this helper, — 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 naga/src/front/spv/next_block.rs:2001 — // HACK(eddyb) this has to go to the parent *twice*, because — 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 naga/src/front/spv/next_block.rs:2030 — // HACK(eddyb) since Naga doesn't explicitly track — 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 naga/src/back/spv/block.rs:3766 — // HACK the loop statement is begin with branch instruction, — 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 naga/src/back/spv/block.rs:4028 — // HACK: SPIR-V doesn't have a atomic subtraction, — 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 naga/src/back/spv/helpers.rs:186 — ///HACK: this is taken from std unstable, remove it when std's floor_char_boundary is stable — 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 naga/src/back/msl/writer.rs:3640 — // HACK: we are forcefully deduplicating the expression here — 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.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×14
  • Duplicated block (9 lines × 2) naga/src/back/hlsl/writer.rs:2224 — naga/src/back/hlsl/writer.rs:2224-2232 | naga/src/back/wgsl/writer.rs:957-965 — `naga/src/back/hlsl/writer.rs` and `naga/src/back/wgsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 18 separate duplicated blocks between them, totalling at least 185 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (9 lines × 2) naga/src/back/hlsl/writer.rs:2583 — naga/src/back/hlsl/writer.rs:2583-2591 | naga/src/back/msl/writer.rs:4078-4086 — `naga/src/back/hlsl/writer.rs` and `naga/src/back/msl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 37 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (9 lines × 2) naga/src/back/hlsl/writer.rs:3677 — naga/src/back/hlsl/writer.rs:3677-3685 | naga/src/back/wgsl/writer.rs:1457-1465 — `naga/src/back/hlsl/writer.rs` and `naga/src/back/wgsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 18 separate duplicated blocks between them, totalling at least 185 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (9 lines × 2) naga/src/front/wgsl/lower/mod.rs:3676 — naga/src/front/wgsl/lower/mod.rs:3676-3684 | naga/src/front/wgsl/lower/mod.rs:3943-3951 — both copies are in the same file, so extract the 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) naga/src/front/wgsl/parse/mod.rs:917 — naga/src/front/wgsl/parse/mod.rs:917-925 | naga/src/front/wgsl/parse/mod.rs:1738-1746 — both copies are in the same file, so extract the 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) naga/src/valid/analyzer.rs:735 — naga/src/valid/analyzer.rs:735-743 | naga/src/valid/analyzer.rs:794-802 — both copies are in the same file, so extract the 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) wgpu-core/src/command/compute.rs:579 — wgpu-core/src/command/compute.rs:579-587 | wgpu-core/src/command/render.rs:2220-2228 — before extracting anything, compare `wgpu-core/src/command/compute.rs` and `wgpu-core/src/command/render.rs` as WHOLE FILES: this scan already matched 6 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 (9 lines × 2) wgpu-core/src/command/transfer.rs:907 — wgpu-core/src/command/transfer.rs:907-915 | wgpu-core/src/command/transfer.rs:958-966 — both copies are in the same file, so extract the 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) wgpu-hal/src/gles/command.rs:502 — wgpu-hal/src/gles/command.rs:502-510 | wgpu-hal/src/gles/command.rs:1224-1232 — both copies are in the same file, so extract the 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) wgpu-hal/src/gles/device.rs:144 — wgpu-hal/src/gles/device.rs:144-152 | wgpu-hal/src/gles/device.rs:170-178 — both copies are in the same file, so extract the 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) wgpu-hal/src/metal/command.rs:673 — wgpu-hal/src/metal/command.rs:673-681 | wgpu-hal/src/metal/command.rs:718-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.
  • Duplicated block (9 lines × 2) naga/src/back/hlsl/help.rs:1521 — naga/src/back/hlsl/help.rs:1521-1530 | naga/src/back/hlsl/help.rs:1572-1580 — both copies are in the same file, so extract the 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) naga/src/proc/namer.rs:366 — naga/src/proc/namer.rs:366-374 | naga/src/proc/namer.rs:381-389 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) naga/src/front/wgsl/parse/mod.rs:1941 — naga/src/front/wgsl/parse/mod.rs:1941-1949 | naga/src/front/wgsl/parse/mod.rs:1982-1990 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D1 · Cyclomatic Complexity · Frontend · ×13
  • Frontend::next_block (cyclomatic 291) naga/src/front/spv/next_block.rs:22 — Frontend::next_block has cyclomatic complexity 291 (threshold 15). Of this number, 289 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Frontend::parse (cyclomatic 53) naga/src/front/spv/mod.rs:1714 — Frontend::parse has cyclomatic complexity 53 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Frontend::parse_image_sample (cyclomatic 41) naga/src/front/spv/image.rs:490 — Frontend::parse_image_sample has cyclomatic complexity 41 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Frontend::function_call (cyclomatic 37) naga/src/front/glsl/functions.rs:515 — Frontend::function_call 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.
  • Frontend::lookup_variable (cyclomatic 28) naga/src/front/glsl/variables.rs:101 — Frontend::lookup_variable has cyclomatic complexity 28 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Frontend::process_entry_point (cyclomatic 25) naga/src/front/spv/function.rs:320 — Frontend::process_entry_point 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.
  • Frontend::parse_global_variable (cyclomatic 23) naga/src/front/spv/mod.rs:2951 — Frontend::parse_global_variable has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: Frontend::next_decoration (cyclomatic 25) 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 function is counted neither in this dimension's figures nor in its score.
  • Frontend::handle_directive (cyclomatic 20) naga/src/front/glsl/parser.rs:248 — Frontend::handle_directive has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Frontend::add_global_var (cyclomatic 20) naga/src/front/glsl/variables.rs:415 — Frontend::add_global_var 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.
  • Frontend::parse_function (cyclomatic 19) naga/src/front/spv/function.rs:28 — Frontend::parse_function 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.
  • Frontend::field_selection (cyclomatic 17) naga/src/front/glsl/variables.rs:244 — Frontend::field_selection has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • Frontend::patch_statements (cyclomatic 17) naga/src/front/spv/mod.rs:1584 — Frontend::patch_statements has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: Frontend::next_decoration (cyclomatic 25) 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 function is counted neither in this dimension's figures nor in its score.
  • Frontend::constructor_single (cyclomatic 16) naga/src/front/glsl/functions.rs:61 — Frontend::constructor_single 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.
D4 · Code Duplication · Duplicated block (13 lines × 2) · ×13
  • Duplicated block (13 lines × 2) deno_webgpu/webidl.rs:54 — deno_webgpu/webidl.rs:54-66 | deno_webgpu/webidl.rs:164-176 — both copies are in the same file, so extract the 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) naga/src/back/hlsl/help.rs:2231 — naga/src/back/hlsl/help.rs:2231-2243 | naga/src/back/hlsl/help.rs:2249-2261 — both copies are in the same file, so extract the 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) naga/src/back/hlsl/storage.rs:357 — naga/src/back/hlsl/storage.rs:357-369 | naga/src/back/hlsl/storage.rs:377-389 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) naga/src/back/hlsl/writer.rs:3316 — naga/src/back/hlsl/writer.rs:3316-3328 | naga/src/back/msl/writer.rs:1859-1871 — `naga/src/back/hlsl/writer.rs` and `naga/src/back/msl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 37 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (13 lines × 2) naga/src/back/spv/mesh_shader.rs:769 — naga/src/back/spv/mesh_shader.rs:769-781 | naga/src/back/spv/mesh_shader.rs:840-852 — both copies are in the same file, so extract the 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) naga/src/common/diagnostic_debug.rs:57 — naga/src/common/diagnostic_debug.rs:57-69 | naga/src/common/diagnostic_display.rs:61-73 — before extracting anything, compare `naga/src/common/diagnostic_debug.rs` and `naga/src/common/diagnostic_display.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 36 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) naga/src/front/wgsl/lower/mod.rs:3531 — naga/src/front/wgsl/lower/mod.rs:3531-3543 | naga/src/front/wgsl/lower/mod.rs:3570-3582 — both copies are in the same file, so extract the 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) wgpu-core/src/command/render.rs:3237 — wgpu-core/src/command/render.rs:3237-3249 | wgpu-core/src/command/render.rs:3457-3469 — both copies are in the same file, so extract the 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) wgpu-core/src/device/resource.rs:1379 — wgpu-core/src/device/resource.rs:1379-1391 | wgpu-core/src/device/resource.rs:1749-1761 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) wgpu-core/src/pipeline.rs:272 — wgpu-core/src/pipeline.rs:272-284 | wgpu-core/src/pipeline.rs:323-335 — both copies are in the same file, so extract the 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) wgpu-core/src/track/texture.rs:1521 — wgpu-core/src/track/texture.rs:1521-1533 | wgpu-core/src/track/texture.rs:1570-1582 — both copies are in the same file, so extract the 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) wgpu-hal/src/vulkan/device.rs:2366 — wgpu-hal/src/vulkan/device.rs:2366-2378 | wgpu-hal/src/vulkan/device.rs:2383-2395 — both copies are in the same file, so extract the 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) naga-cli/src/bin/naga.rs:949 — naga-cli/src/bin/naga.rs:949-961 | naga-cli/src/bin/naga.rs:984-996 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D2 · Cognitive Complexity · Validator · ×11
  • Validator::validate_block_impl (cognitive 338) naga/src/valid/function.rs:789 — Validator::validate_block_impl has cognitive complexity 338 (threshold 15). Drivers by points: if/else 55 (183 pts), match/switch 37 (134 pts), loops 7 (19 pts), boolean chains 2 (nesting depth added 237). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Validator::validate_expression (cognitive 295) naga/src/valid/expression.rs:382 — Validator::validate_expression has cognitive complexity 295 (threshold 15). Drivers by points: match/switch 68 (170 pts), if/else 51 (110 pts), boolean chains 9, loops 3 (6 pts) (nesting depth added 164). Of this number, 293 points are the body's own statements and 2 belong to one function item inside it that branches. 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.
  • Validator::validate_type (cognitive 157) naga/src/valid/type.rs:383 — Validator::validate_type has cognitive complexity 157 (threshold 15). Drivers by points: if/else 48 (119 pts), match/switch 12 (28 pts), boolean chains 8, loops 1 (2 pts) (nesting depth added 88). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Validator::validate_entry_point (cognitive 119) naga/src/valid/interface.rs:1257 — Validator::validate_entry_point has cognitive complexity 119 (threshold 15). Drivers by points: if/else 43 (96 pts), match/switch 10 (19 pts), boolean chains 2, loops 2 (nesting depth added 62). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • Validator::validate_global_var (cognitive 72) naga/src/valid/interface.rs:920 — Validator::validate_global_var has cognitive complexity 72 (threshold 15). Drivers by points: if/else 24 (51 pts), match/switch 8 (18 pts), boolean chains 3 (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.
  • Validator::validate_module_handles (cognitive 65) naga/src/valid/handles.rs:34 — Validator::validate_module_handles has cognitive complexity 65 (threshold 15). Drivers by points: loops 21 (37 pts), if/else 15 (25 pts), match/switch 1 (3 pts) (nesting depth added 28). 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.
  • Validator::validate_atomic (cognitive 51) naga/src/valid/function.rs:424 — Validator::validate_atomic has cognitive complexity 51 (threshold 15). Drivers by points: if/else 23 (48 pts), match/switch 2, boolean chains 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Validator::validate_function (cognitive 32) naga/src/valid/function.rs:1875 — Validator::validate_function has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (22 pts), match/switch 2 (5 pts), loops 3, 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.
  • Validator::check_width (cognitive 31) naga/src/valid/type.rs:289 — Validator::check_width has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (28 pts), match/switch 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.
  • Validator::validate_block_handles (cognitive 18) naga/src/valid/handles.rs:680 — Validator::validate_block_handles has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 5 (9 pts), loops 3 (6 pts), if/else 2 (3 pts) (nesting depth added 8). 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.
  • Validator::validate_impl (cognitive 18) naga/src/valid/mod.rs:765 — Validator::validate_impl has cognitive complexity 18 (threshold 15). Drivers by points: loops 8 (11 pts), match/switch 2 (4 pts), if/else 2 (3 pts) (nesting depth added 6). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D4 · Code Duplication · Duplicated block (15 lines × 2) · ×11
  • Duplicated block (15 lines × 2) naga/src/back/glsl/writer.rs:244 — naga/src/back/glsl/writer.rs:244-258 | naga/src/back/msl/writer.rs:4875-4889 — `naga/src/back/glsl/writer.rs` and `naga/src/back/msl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 66 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (15 lines × 2) naga/src/back/glsl/writer.rs:2481 — naga/src/back/glsl/writer.rs:2481-2495 | naga/src/back/wgsl/writer.rs:1582-1596 — `naga/src/back/glsl/writer.rs` and `naga/src/back/wgsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 135 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (15 lines × 2) naga/src/back/hlsl/help.rs:1132 — naga/src/back/hlsl/help.rs:1132-1146 | naga/src/back/hlsl/help.rs:1209-1223 — both copies are in the same file, so extract the 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) naga/src/back/hlsl/help.rs:1638 — naga/src/back/hlsl/help.rs:1638-1652 | naga/src/back/hlsl/help.rs:1703-1717 — both copies are in the same file, so extract the 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) naga/src/back/hlsl/writer.rs:2925 — naga/src/back/hlsl/writer.rs:2925-2939 | naga/src/back/hlsl/writer.rs:2989-3003 — both copies are in the same file, so extract the 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) naga/src/front/glsl/builtins.rs:666 — naga/src/front/glsl/builtins.rs:666-680 | naga/src/front/glsl/builtins.rs:1061-1075 — both copies are in the same file, so extract the 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) naga/src/front/glsl/builtins.rs:1448 — naga/src/front/glsl/builtins.rs:1448-1462 | naga/src/front/glsl/builtins.rs:1477-1491 — both copies are in the same file, so extract the 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) naga/src/valid/analyzer.rs:450 — naga/src/valid/analyzer.rs:450-464 | naga/src/valid/analyzer.rs:466-480 — both copies are in the same file, so extract the 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) naga/src/valid/expression.rs:801 — naga/src/valid/expression.rs:801-815 | naga/src/valid/expression.rs:816-830 — both copies are in the same file, so extract the 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) naga/src/valid/interface.rs:505 — naga/src/valid/interface.rs:505-519 | naga/src/valid/interface.rs:521-535 — both copies are in the same file, so extract the 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) wgpu/src/backend/webgpu.rs:3828 — wgpu/src/backend/webgpu.rs:3828-3842 | wgpu/src/backend/webgpu.rs:4115-4129 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D1 · Cyclomatic Complexity · Validator · ×10
  • Validator::validate_expression (cyclomatic 211) naga/src/valid/expression.rs:382 — Validator::validate_expression has cyclomatic complexity 211 (threshold 15). Of this number, 205 points are the body's own statements and 6 belong to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Validator::validate_block_impl (cyclomatic 133) naga/src/valid/function.rs:789 — Validator::validate_block_impl has cyclomatic complexity 133 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Validator::validate_type (cyclomatic 83) naga/src/valid/type.rs:383 — Validator::validate_type has cyclomatic complexity 83 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Validator::validate_entry_point (cyclomatic 79) naga/src/valid/interface.rs:1257 — Validator::validate_entry_point has cyclomatic complexity 79 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Validator::validate_global_var (cyclomatic 50) naga/src/valid/interface.rs:920 — Validator::validate_global_var has cyclomatic complexity 50 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Validator::validate_module_handles (cyclomatic 38) naga/src/valid/handles.rs:34 — Validator::validate_module_handles has cyclomatic complexity 38 (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.
  • Validator::validate_block_handles (cyclomatic 33) naga/src/valid/handles.rs:680 — Validator::validate_block_handles has cyclomatic complexity 33 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: Validator::validate_expression_handles (cyclomatic 34) 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 function is counted neither in this dimension's figures nor in its score.
  • Validator::validate_atomic (cyclomatic 25) naga/src/valid/function.rs:424 — Validator::validate_atomic 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.
  • Validator::validate_function (cyclomatic 19) naga/src/valid/function.rs:1875 — Validator::validate_function 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.
  • Validator::check_width (cyclomatic 18) naga/src/valid/type.rs:289 — Validator::check_width has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CommandEncoder · ×10
  • CommandEncoder::begin_render_pass (cyclomatic 34) wgpu-hal/src/gles/command.rs:498 — CommandEncoder::begin_render_pass 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.
  • CommandEncoder::update_bind_group_state (cyclomatic 31) wgpu-hal/src/metal/command.rs:311 — CommandEncoder::update_bind_group_state has cyclomatic complexity 31 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • CommandEncoder::begin_render_pass_inner::fill_arc_desc (cyclomatic 30) wgpu-core/src/command/render.rs:1887 — CommandEncoder::begin_render_pass_inner::fill_arc_desc 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.
  • CommandEncoder::begin_render_pass (cyclomatic 27) wgpu-hal/src/metal/command.rs:895 — CommandEncoder::begin_render_pass 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.
  • CommandEncoder::encode_commands (cyclomatic 23) wgpu-core/src/command/mod.rs:1085 — CommandEncoder::encode_commands has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • CommandEncoder::begin_render_pass (cyclomatic 23) wgpu-hal/src/dx12/command.rs:1026 — CommandEncoder::begin_render_pass 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.
  • CommandEncoder::update_root_elements (cyclomatic 22) wgpu-hal/src/dx12/command.rs:271 — CommandEncoder::update_root_elements has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • CommandEncoder::set_render_pipeline (cyclomatic 21) wgpu-hal/src/gles/command.rs:872 — CommandEncoder::set_render_pipeline 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.
  • CommandEncoder::push_barrier (cyclomatic 18) wgpu-hal/src/dx12/command.rs:90 — CommandEncoder::push_barrier 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.
  • CommandEncoder::set_render_pipeline (cyclomatic 18) wgpu-hal/src/metal/command.rs:1290 — CommandEncoder::set_render_pipeline 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.
D4 · Code Duplication · Duplicated block (16 lines × 2) · ×10
  • Duplicated block (16 lines × 2) naga/src/back/glsl/writer.rs:1618 — naga/src/back/glsl/writer.rs:1618-1633 | naga/src/back/hlsl/writer.rs:2200-2215 — `naga/src/back/glsl/writer.rs` and `naga/src/back/hlsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 86 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (16 lines × 2) naga/src/back/hlsl/help.rs:1401 — naga/src/back/hlsl/help.rs:1401-1416 | naga/src/back/hlsl/help.rs:1443-1458 — both copies are in the same file, so extract the 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) naga/src/back/spv/image.rs:623 — naga/src/back/spv/image.rs:623-638 | naga/src/back/spv/image.rs:646-661 — both copies are in the same file, so extract the 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) naga/src/back/spv/mesh_shader.rs:891 — naga/src/back/spv/mesh_shader.rs:891-906 | naga/src/back/spv/mesh_shader.rs:914-929 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) naga/src/front/glsl/parser.rs:274 — naga/src/front/glsl/parser.rs:274-289 | naga/src/front/glsl/parser.rs:352-367 — both copies are in the same file, so extract the 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) naga/src/valid/interface.rs:537 — naga/src/valid/interface.rs:537-552 | naga/src/valid/interface.rs:554-569 — both copies are in the same file, so extract the 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) wgpu-core/src/indirect_validation/dispatch.rs:88 — wgpu-core/src/indirect_validation/dispatch.rs:88-103 | wgpu-core/src/indirect_validation/draw.rs:555-570 — before extracting anything, compare `wgpu-core/src/indirect_validation/dispatch.rs` and `wgpu-core/src/indirect_validation/draw.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 83 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (16 lines × 2) wgpu-core/src/track/texture.rs:1256 — wgpu-core/src/track/texture.rs:1256-1271 | wgpu-core/src/track/texture.rs:1500-1515 — both copies are in the same file, so extract the 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) wgpu-hal/src/metal/conv.rs:443 — wgpu-hal/src/metal/conv.rs:443-458 | wgpu-hal/src/metal/conv.rs:474-489 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) naga/src/back/msl/writer.rs:6422 — naga/src/back/msl/writer.rs:6422-6437 | naga/src/back/msl/writer.rs:6517-6534 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D1 · Cyclomatic Complexity · wgpu_core · ×9
  • wgpu_core::command::ray_tracing::iter_blas (cyclomatic 49) wgpu-core/src/command/ray_tracing.rs:588 — wgpu_core::command::ray_tracing::iter_blas has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • wgpu_core::command::render::encode_render_pass (cyclomatic 29) wgpu-core/src/command/render.rs:2265 — wgpu_core::command::render::encode_render_pass has cyclomatic complexity 29 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • wgpu_core::track::texture::update (cyclomatic 21) wgpu-core/src/track/texture.rs:1460 — wgpu_core::track::texture::update has cyclomatic complexity 21 (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.
  • wgpu_core::command::ray_tracing::build_acceleration_structures (cyclomatic 20) wgpu-core/src/command/ray_tracing.rs:195 — wgpu_core::command::ray_tracing::build_acceleration_structures 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.
  • wgpu_core::track::texture::barrier (cyclomatic 18) wgpu-core/src/track/texture.rs:1341 — wgpu_core::track::texture::barrier 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.
  • wgpu_core::command::compute::encode_compute_pass (cyclomatic 17) wgpu-core/src/command/compute.rs:622 — wgpu_core::command::compute::encode_compute_pass has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • wgpu_core::device::surface_config::validate_surface_configuration (cyclomatic 17) wgpu-core/src/device/surface_config.rs:44 — wgpu_core::device::surface_config::validate_surface_configuration 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.
  • wgpu_core::track::texture::merge (cyclomatic 17) wgpu-core/src/track/texture.rs:1207 — wgpu_core::track::texture::merge 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.
  • wgpu_core::command::transfer::copy_texture_to_texture (cyclomatic 16) wgpu-core/src/command/transfer.rs:1453 — wgpu_core::command::transfer::copy_texture_to_texture 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.
D2 · Cognitive Complexity · wgpu_core · ×9
  • wgpu_core::command::ray_tracing::iter_blas (cognitive 158) wgpu-core/src/command/ray_tracing.rs:588 — wgpu_core::command::ray_tracing::iter_blas has cognitive complexity 158 (threshold 15). Drivers by points: if/else 36 (131 pts), match/switch 4 (14 pts), loops 3 (7 pts), boolean chains 6 (nesting depth added 109). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • wgpu_core::track::texture::update (cognitive 58) wgpu-core/src/track/texture.rs:1460 — wgpu_core::track::texture::update has cognitive complexity 58 (threshold 15). Drivers by points: loops 10 (35 pts), if/else 5 (20 pts), match/switch 2, boolean chains 1 (nesting depth added 40). 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.
  • wgpu_core::track::texture::barrier (cognitive 44) wgpu-core/src/track/texture.rs:1341 — wgpu_core::track::texture::barrier has cognitive complexity 44 (threshold 15). Drivers by points: if/else 7 (26 pts), loops 6 (16 pts), boolean chains 1, match/switch 1 (nesting depth added 29). 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.
  • wgpu_core::track::texture::merge (cognitive 43) wgpu-core/src/track/texture.rs:1207 — wgpu_core::track::texture::merge has cognitive complexity 43 (threshold 15). Drivers by points: loops 8 (23 pts), if/else 5 (19 pts), match/switch 1 (nesting depth added 29). 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.
  • wgpu_core::command::ray_tracing::build_acceleration_structures (cognitive 37) wgpu-core/src/command/ray_tracing.rs:195 — wgpu_core::command::ray_tracing::build_acceleration_structures has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (26 pts), loops 5 (7 pts), match/switch 1 (3 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.
  • wgpu_core::command::clear::clear_texture_via_buffer_copies (cognitive 24) wgpu-core/src/command/clear.rs:413 — wgpu_core::command::clear::clear_texture_via_buffer_copies has cognitive complexity 24 (threshold 15). Drivers by points: loops 5 (15 pts), if/else 6 (9 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.
  • wgpu_core::device::surface_config::validate_surface_configuration (cognitive 21) wgpu-core/src/device/surface_config.rs:44 — wgpu_core::device::surface_config::validate_surface_configuration has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (13 pts), match/switch 2 (4 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
  • wgpu_core::command::transfer::copy_texture_to_texture (cognitive 18) wgpu-core/src/command/transfer.rs:1453 — wgpu_core::command::transfer::copy_texture_to_texture has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 5 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • wgpu_core::command::render::multi_draw_indirect (cognitive 17) wgpu-core/src/command/render.rs:3192 — wgpu_core::command::render::multi_draw_indirect has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 2, loops 1 (2 pts), match/switch 2 (nesting depth added 4). Of this number, 16 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D30 · Dependency Vulnerabilities · Medium advisory (unmaintained) · ×9
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (18 lines × 2) · ×9
  • Duplicated block (18 lines × 2) deno_webgpu/compute_pass.rs:162 — deno_webgpu/compute_pass.rs:162-179 | deno_webgpu/render_pass.rs:218-235 — before extracting anything, compare `deno_webgpu/compute_pass.rs` and `deno_webgpu/render_pass.rs` 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 (18 lines × 2) naga/src/back/hlsl/writer.rs:4232 — naga/src/back/hlsl/writer.rs:4232-4249 | naga/src/back/wgsl/writer.rs:1647-1664 — `naga/src/back/hlsl/writer.rs` and `naga/src/back/wgsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 18 separate duplicated blocks between them, totalling at least 185 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (18 lines × 2) naga/src/back/wgsl/writer.rs:396 — naga/src/back/wgsl/writer.rs:396-413 | naga/src/back/wgsl/writer.rs:415-432 — both copies are in the same file, so extract the 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) naga/src/front/spv/next_block.rs:872 — naga/src/front/spv/next_block.rs:872-889 | naga/src/front/spv/next_block.rs:976-993 — both copies are in the same file, so extract the 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) naga/src/front/spv/next_block.rs:2450 — naga/src/front/spv/next_block.rs:2450-2467 | naga/src/front/spv/next_block.rs:2495-2512 — both copies are in the same file, so extract the 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) naga/src/front/wgsl/lower/construction.rs:387 — naga/src/front/wgsl/lower/construction.rs:387-404 | naga/src/front/wgsl/lower/construction.rs:424-441 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18 lines × 2) naga/src/valid/function.rs:1634 — naga/src/valid/function.rs:1634-1651 | naga/src/valid/function.rs:1655-1672 — both copies are in the same file, so extract the 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) wgpu-core/src/command/mod.rs:222 — wgpu-core/src/command/mod.rs:222-239 | wgpu-core/src/command/mod.rs:266-283 — both copies are in the same file, so extract the 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) wgpu-core/src/device/resource.rs:4659 — wgpu-core/src/device/resource.rs:4659-4676 | wgpu-core/src/device/resource.rs:5607-5624 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D2 · Cognitive Complexity · Lowerer · ×8
  • Lowerer::call_builtin (cognitive 90) naga/src/front/wgsl/lower/mod.rs:3110 — Lowerer::call_builtin has cognitive complexity 90 (threshold 15). Drivers by points: if/else 26 (51 pts), match/switch 10 (32 pts), loops 2 (6 pts), boolean chains 1 (nesting depth added 51). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Lowerer::statement (cognitive 86) naga/src/front/wgsl/lower/mod.rs:1810 — Lowerer::statement has cognitive complexity 86 (threshold 15). Drivers by points: match/switch 20 (46 pts), if/else 16 (37 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 48). 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.
  • Lowerer::expression_for_reference (cognitive 56) naga/src/front/wgsl/lower/mod.rs:2407 — Lowerer::expression_for_reference has cognitive complexity 56 (threshold 15). Drivers by points: if/else 10 (33 pts), match/switch 9 (19 pts), loops 1 (4 pts) (nesting depth added 36). 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.
  • Lowerer::function (cognitive 55) naga/src/front/wgsl/lower/mod.rs:1576 — Lowerer::function has cognitive complexity 55 (threshold 15). Drivers by points: if/else 17 (35 pts), match/switch 5 (17 pts), loops 1 (3 pts) (nesting depth added 32). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • Lowerer::r#struct (cognitive 36) naga/src/front/wgsl/lower/mod.rs:4792 — Lowerer::r#struct has cognitive complexity 36 (threshold 15). Drivers by points: if/else 18 (34 pts), loops 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Lowerer::lower (cognitive 31) naga/src/front/wgsl/lower/mod.rs:1289 — Lowerer::lower has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (21 pts), match/switch 3 (9 pts), loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Lowerer::resolve_overloads (cognitive 24) naga/src/front/wgsl/lower/mod.rs:4291 — Lowerer::resolve_overloads has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (20 pts), 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.
  • Lowerer::finalize_type (cognitive 17) naga/src/front/wgsl/lower/mod.rs:2834 — Lowerer::finalize_type has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (14 pts), match/switch 2 (3 pts) (nesting depth added 10). 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.
D1 · Cyclomatic Complexity · Lowerer · ×7
  • Lowerer::call_builtin (cyclomatic 74) naga/src/front/wgsl/lower/mod.rs:3110 — Lowerer::call_builtin has cyclomatic complexity 74 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Lowerer::statement (cyclomatic 51) naga/src/front/wgsl/lower/mod.rs:1810 — Lowerer::statement has cyclomatic complexity 51 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Lowerer::expression_for_reference (cyclomatic 42) naga/src/front/wgsl/lower/mod.rs:2407 — Lowerer::expression_for_reference has cyclomatic complexity 42 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Lowerer::construct (cyclomatic 31) naga/src/front/wgsl/lower/construction.rs:107 — Lowerer::construct has cyclomatic complexity 31 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Lowerer::lower (cyclomatic 20) naga/src/front/wgsl/lower/mod.rs:1289 — Lowerer::lower 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.
  • Lowerer::function (cyclomatic 20) naga/src/front/wgsl/lower/mod.rs:1576 — Lowerer::function 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.
  • Lowerer::finalize_type (cyclomatic 19) naga/src/front/wgsl/lower/mod.rs:2834 — Lowerer::finalize_type has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D17 · Explicit Debt · FixmeComment · ×7
  • FixmeComment wgpu-types/src/write_only.rs:40 — // FIXME: Add an introduction to the necessity of explicit reborrowing. — 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 wgpu-types/src/write_only.rs:130 — // FIXME: Use `NonNull::from_mut()` when MSRV ≥ 1.89.0 — 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 wgpu-types/src/write_only.rs:244 — // FIXME: When `feature(slice_ptr_get)` <https://github.com/rust-lang/rust/issues/74265>
  • FixmeComment wgpu-types/src/write_only.rs:809 — // FIXME: cleaner panic messages — 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 wgpu-sync/src/lib.rs:31 — // FIXME: — 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 tests/tests/wgpu-validation/api/buffer_mapping.rs:1 — // FIXME: Now that MAP_WRITE mappings are write-only, — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment tests/tests/wgpu-validation/api/buffer_mapping.rs:16 — // FIXME: Is the goal of these tests to ensure that zeroes are what is exposed to Rust, — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
D2 · Cognitive Complexity · BlockContext · ×7
  • BlockContext::cache_expression_value (cognitive 183) naga/src/back/spv/block.rs:790 — BlockContext::cache_expression_value has cognitive complexity 183 (threshold 15). Drivers by points: match/switch 49 (122 pts), if/else 29 (58 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 103). 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.
  • BlockContext::write_block (cognitive 135) naga/src/back/spv/block.rs:3533 — BlockContext::write_block has cognitive complexity 135 (threshold 15). Drivers by points: match/switch 22 (59 pts), if/else 20 (57 pts), loops 6 (16 pts), boolean chains 3 (nesting depth added 84). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • BlockContext::write_checked_load (cognitive 25) naga/src/back/spv/block.rs:2856 — BlockContext::write_checked_load has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 5 (12 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.
  • BlockContext::write_access_chain (cognitive 23) naga/src/back/spv/block.rs:2571 — BlockContext::write_access_chain has cognitive complexity 23 (threshold 15). Drivers by points: match/switch 6 (14 pts), if/else 5 (8 pts), loops 1 (nesting depth added 11). 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.
  • BlockContext::write_as_expression (cognitive 22) naga/src/back/spv/block.rs:2293 — BlockContext::write_as_expression has cognitive complexity 22 (threshold 15). Drivers by points: match/switch 8 (12 pts), if/else 4 (7 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 8). 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.
  • BlockContext::write_image_query (cognitive 22) naga/src/back/spv/image.rs:1116 — BlockContext::write_image_query has cognitive complexity 22 (threshold 15). Drivers by points: match/switch 9 (17 pts), if/else 3 (5 pts) (nesting depth added 10). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • BlockContext::write_image_sample (cognitive 21) naga/src/back/spv/image.rs:803 — BlockContext::write_image_sample has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (15 pts), match/switch 3 (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.
D4 · Code Duplication · Duplicated block (14 lines × 2) · ×7
  • Duplicated block (14 lines × 2) deno_webgpu/device.rs:493 — deno_webgpu/device.rs:493-506 | deno_webgpu/device.rs:533-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.
  • Duplicated block (14 lines × 2) naga/src/back/spv/block.rs:3267 — naga/src/back/spv/block.rs:3267-3280 | naga/src/back/spv/block.rs:3367-3380 — both copies are in the same file, so extract the 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) naga/src/back/spv/ray/mod.rs:68 — naga/src/back/spv/ray/mod.rs:68-81 | naga/src/back/spv/ray/mod.rs:102-115 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) naga/src/common/wgsl/types.rs:275 — naga/src/common/wgsl/types.rs:275-288 | naga/src/common/wgsl/types.rs:292-305 — both copies are in the same file, so extract the 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) naga/src/front/wgsl/lower/construction.rs:194 — naga/src/front/wgsl/lower/construction.rs:194-207 | naga/src/front/wgsl/lower/construction.rs:216-229 — both copies are in the same file, so extract the 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) wgpu-core/src/command/transfer.rs:1243 — wgpu-core/src/command/transfer.rs:1243-1256 | wgpu-core/src/command/transfer.rs:1360-1373 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) naga/src/valid/type.rs:324 — naga/src/valid/type.rs:324-337 | naga/src/valid/type.rs:348-361 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D1 · Cyclomatic Complexity · BlockContext · ×6
  • BlockContext::cache_expression_value (cyclomatic 249) naga/src/back/spv/block.rs:790 — BlockContext::cache_expression_value has cyclomatic complexity 249 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • BlockContext::write_block (cyclomatic 83) naga/src/back/spv/block.rs:3533 — BlockContext::write_block has cyclomatic complexity 83 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • BlockContext::write_as_expression (cyclomatic 32) naga/src/back/spv/block.rs:2293 — BlockContext::write_as_expression has cyclomatic complexity 32 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • BlockContext::write_access_chain (cyclomatic 18) naga/src/back/spv/block.rs:2571 — BlockContext::write_access_chain has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • BlockContext::write_image_sample (cyclomatic 18) naga/src/back/spv/image.rs:803 — BlockContext::write_image_sample 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.
  • BlockContext::write_image_query (cyclomatic 18) naga/src/back/spv/image.rs:1116 — BlockContext::write_image_query has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D2 · Cognitive Complexity · ParsingContext · ×6
  • ParsingContext::parse_statement (cognitive 74) naga/src/front/glsl/parser/functions.rs:41 — ParsingContext::parse_statement has cognitive complexity 74 (threshold 15). Drivers by points: if/else 21 (45 pts), match/switch 7 (21 pts), loops 2 (5 pts), boolean chains 3 (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ParsingContext::parse_declaration (cognitive 49) naga/src/front/glsl/parser/declarations.rs:294 — ParsingContext::parse_declaration has cognitive complexity 49 (threshold 15). Drivers by points: if/else 12 (25 pts), match/switch 7 (23 pts), boolean chains 1 (nesting depth added 29). 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.
  • ParsingContext::parse_type_qualifiers (cognitive 26) naga/src/front/glsl/parser/types.rs:169 — ParsingContext::parse_type_qualifiers has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (20 pts), match/switch 2 (5 pts), loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ParsingContext::parse_postfix (cognitive 23) naga/src/front/glsl/parser/expressions.rs:125 — ParsingContext::parse_postfix has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (11 pts), match/switch 4 (11 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ParsingContext::parse_init_declarator_list (cognitive 21) naga/src/front/glsl/parser/declarations.rs:167 — ParsingContext::parse_init_declarator_list has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (14 pts), match/switch 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ParsingContext::parse_layout_qualifier_id (cognitive 17) naga/src/front/glsl/parser/types.rs:325 — ParsingContext::parse_layout_qualifier_id has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), match/switch 3 (8 pts) (nesting depth added 10). 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.
D4 · Code Duplication · Duplicated block (12 lines × 3) · ×6
  • Duplicated block (12 lines × 3) deno_webgpu/compute_pass.rs:168 — deno_webgpu/compute_pass.rs:168-179 | deno_webgpu/render_bundle.rs:162-173 | deno_webgpu/render_pass.rs:224-235 — before extracting anything, compare `deno_webgpu/compute_pass.rs` and `deno_webgpu/render_pass.rs` 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 (12 lines × 3) naga/src/back/msl/ray.rs:419 — naga/src/back/msl/ray.rs:419-430 | naga/src/back/msl/ray.rs:473-484 | naga/src/back/msl/ray.rs:503-514 — 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 (12 lines × 3) naga/src/back/spv/mesh_shader.rs:85 — naga/src/back/spv/mesh_shader.rs:85-96 | naga/src/back/spv/mesh_shader.rs:108-119 | naga/src/back/spv/mesh_shader.rs:121-132 — 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 (12 lines × 3) naga/src/front/glsl/builtins.rs:349 — naga/src/front/glsl/builtins.rs:349-360 | naga/src/front/glsl/builtins.rs:373-384 | naga/src/front/glsl/builtins.rs:412-423 — 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 (12 lines × 3) naga/src/valid/interface.rs:479 — naga/src/valid/interface.rs:479-490 | naga/src/valid/interface.rs:492-503 | naga/src/valid/interface.rs:631-642 — 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 (12 lines × 3) naga/src/front/wgsl/lower/mod.rs:3624 — naga/src/front/wgsl/lower/mod.rs:3624-3635 | naga/src/front/wgsl/lower/mod.rs:3637-3648 | naga/src/front/wgsl/lower/mod.rs:3650-3661 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (6 lines × 3) · ×6
  • Duplicated block (6 lines × 3) naga/src/back/hlsl/writer.rs:2723 — naga/src/back/hlsl/writer.rs:2723-2728 | naga/src/back/hlsl/writer.rs:2932-2937 | naga/src/back/hlsl/writer.rs:2996-3001 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (6 lines × 3) naga/src/front/spv/mod.rs:1007 — naga/src/front/spv/mod.rs:1007-1012 | naga/src/front/spv/mod.rs:1037-1042 | naga/src/front/spv/mod.rs:1317-1322 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (6 lines × 3) wgpu-core/src/binding_model.rs:1286 — wgpu-core/src/binding_model.rs:1286-1291 | wgpu-core/src/binding_model.rs:1775-1780 | wgpu-core/src/pipeline.rs:114-119 — 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 (6 lines × 3) wgpu-core/src/binding_model.rs:1293 — wgpu-core/src/binding_model.rs:1293-1298 | wgpu-core/src/pipeline.rs:611-616 | wgpu-core/src/pipeline.rs:1245-1250 — 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 (6 lines × 3) naga/src/back/msl/writer.rs:5076 — naga/src/back/msl/writer.rs:5076-5081 | naga/src/back/msl/writer.rs:5258-5268 | naga/src/back/msl/writer.rs:5644-5654 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (6 lines × 3) wgpu-hal/src/auxil/dxgi/dxgi_lib.rs:50 — wgpu-hal/src/auxil/dxgi/dxgi_lib.rs:50-55 | wgpu-hal/src/auxil/dxgi/dxgi_lib.rs:74-81 | wgpu-hal/src/auxil/dxgi/dxgi_lib.rs:98-103 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (5 lines × 3) · ×6
  • Duplicated block (5 lines × 3) naga/src/back/hlsl/help.rs:1056 — naga/src/back/hlsl/help.rs:1056-1060 | naga/src/back/hlsl/help.rs:1117-1121 | naga/src/back/hlsl/help.rs:1196-1200 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (5 lines × 3) naga/src/back/hlsl/storage.rs:357 — naga/src/back/hlsl/storage.rs:357-361 | naga/src/back/hlsl/storage.rs:377-381 | naga/src/back/hlsl/storage.rs:428-433 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (5 lines × 3) naga/src/front/wgsl/parse/mod.rs:1898 — naga/src/front/wgsl/parse/mod.rs:1898-1902 | naga/src/front/wgsl/parse/mod.rs:1904-1908 | naga/src/front/wgsl/parse/mod.rs:1910-1914 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (5 lines × 3) wgpu-hal/src/gles/queue.rs:70 — wgpu-hal/src/gles/queue.rs:70-74 | wgpu-hal/src/gles/queue.rs:91-95 | wgpu-hal/src/gles/web.rs:289-293 — 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 (5 lines × 3) naga/src/back/hlsl/writer.rs:3827 — naga/src/back/hlsl/writer.rs:3827-3844 | naga/src/back/hlsl/writer.rs:3854-3860 | naga/src/back/hlsl/writer.rs:3870-3874 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (5 lines × 3) naga/src/back/msl/writer.rs:2403 — naga/src/back/msl/writer.rs:2403-2407 | naga/src/back/msl/writer.rs:2412-2416 | naga/src/back/msl/writer.rs:2422-2426 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D1 · Cyclomatic Complexity · Adapter · ×5
  • Adapter::expose (cyclomatic 103) wgpu-hal/src/dx12/adapter.rs:65 — Adapter::expose has cyclomatic complexity 103 (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.
  • Adapter::expose (cyclomatic 96) wgpu-hal/src/gles/adapter.rs:195 — Adapter::expose has cyclomatic complexity 96 (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.
  • Adapter::texture_format_capabilities (cyclomatic 55) wgpu-hal/src/gles/adapter.rs:1149 — Adapter::texture_format_capabilities has cyclomatic complexity 55 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Adapter::texture_format_capabilities (cyclomatic 50) wgpu-hal/src/metal/adapter.rs:176 — Adapter::texture_format_capabilities has cyclomatic complexity 50 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Adapter::device_from_raw (cyclomatic 47) wgpu-hal/src/vulkan/adapter.rs:2647 — Adapter::device_from_raw has cyclomatic complexity 47 (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.
D2 · Cognitive Complexity · ConstantEvaluator · ×5
  • ConstantEvaluator::binary_op (cognitive 147) naga/src/proc/constant_evaluator.rs:2858 — ConstantEvaluator::binary_op has cognitive complexity 147 (threshold 15). Drivers by points: if/else 27 (85 pts), match/switch 16 (52 pts), boolean chains 6, loops 2 (4 pts) (nesting depth added 96). Of this number, 144 points are the body's own statements and 3 belong to one function item inside it that branches. 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.
  • ConstantEvaluator::math (cognitive 60) naga/src/proc/constant_evaluator.rs:1489 — ConstantEvaluator::math has cognitive complexity 60 (threshold 15). Drivers by points: if/else 21 (40 pts), match/switch 9 (16 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 27). Of this number, 41 points are the body's own statements and 19 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ConstantEvaluator::cast (cognitive 35) naga/src/proc/constant_evaluator.rs:2486 — ConstantEvaluator::cast has cognitive complexity 35 (threshold 15). Drivers by points: match/switch 15 (33 pts), loops 1 (2 pts) (nesting depth added 19). 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.
  • ConstantEvaluator::select (cognitive 23) naga/src/proc/constant_evaluator.rs:3700 — ConstantEvaluator::select has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (15 pts), match/switch 4 (8 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.
  • ConstantEvaluator::unary_op (cognitive 16) naga/src/proc/constant_evaluator.rs:2800 — ConstantEvaluator::unary_op has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 6 (14 pts), loops 1 (2 pts) (nesting depth added 9). 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.
D4 · Code Duplication · Duplicated block (22 lines × 2) · ×5
  • Duplicated block (22 lines × 2) naga/src/back/glsl/writer.rs:2231 — naga/src/back/glsl/writer.rs:2231-2252 | naga/src/back/wgsl/writer.rs:1168-1189 — `naga/src/back/glsl/writer.rs` and `naga/src/back/wgsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 135 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 (22 lines × 2) naga/src/front/spv/mod.rs:2443 — naga/src/front/spv/mod.rs:2443-2464 | naga/src/front/spv/mod.rs:2494-2515 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (22 lines × 2) wgpu-core/src/command/compute.rs:1183 — wgpu-core/src/command/compute.rs:1183-1204 | wgpu-core/src/command/render.rs:3618-3639 — before extracting anything, compare `wgpu-core/src/command/compute.rs` and `wgpu-core/src/command/render.rs` as WHOLE FILES: this scan already matched 6 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 (22 lines × 2) wgpu-core/src/indirect_validation/dispatch.rs:302 — wgpu-core/src/indirect_validation/dispatch.rs:302-323 | wgpu-core/src/indirect_validation/draw.rs:190-211 — before extracting anything, compare `wgpu-core/src/indirect_validation/dispatch.rs` and `wgpu-core/src/indirect_validation/draw.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 83 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) wgpu-hal/src/dx12/suballocation.rs:461 — wgpu-hal/src/dx12/suballocation.rs:461-482 | wgpu-hal/src/dx12/suballocation.rs:504-525 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (21 lines × 2) · ×5
  • Duplicated block (21 lines × 2) naga/src/back/msl/writer.rs:5910 — naga/src/back/msl/writer.rs:5910-5930 | naga/src/back/msl/writer.rs:6184-6204 — both copies are in the same file, so extract the 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 (21 lines × 2) naga/src/front/glsl/functions.rs:1037 — naga/src/front/glsl/functions.rs:1037-1057 | naga/src/front/glsl/functions.rs:1126-1146 — both copies are in the same file, so extract the 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 (21 lines × 2) wgpu-core/src/command/bundle.rs:1244 — wgpu-core/src/command/bundle.rs:1244-1264 | wgpu-core/src/command/render.rs:3157-3177 — before extracting anything, compare `wgpu-core/src/command/bundle.rs` and `wgpu-core/src/command/render.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 83 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) wgpu-hal/src/dx12/command.rs:1543 — wgpu-hal/src/dx12/command.rs:1543-1563 | wgpu-hal/src/dx12/command.rs:1582-1602 — both copies are in the same file, so extract the 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 (21 lines × 2) wgpu-hal/src/dx12/suballocation.rs:427 — wgpu-hal/src/dx12/suballocation.rs:427-447 | wgpu-hal/src/dx12/suballocation.rs:467-487 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D5 · Coupling · Off the main sequence · ×5
  • Off the main sequence: hlsl-snapshots — hlsl-snapshots: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
  • Off the main sequence: naga-types — naga-types: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 5 project(s), so it's rigid to change.
  • Off the main sequence: wgpu-sync — wgpu-sync: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
  • Off the main sequence: wgpu-types — wgpu-types: abstractness 0.09, instability 0.11, distance 0.80 — zone of pain — concrete and depended on by 8 project(s), so it's rigid to change.
  • Off the main sequence: naga — naga: abstractness 0.06, instability 0.17, distance 0.77 — zone of pain — concrete and depended on by 5 project(s), so it's rigid to change.
D1 · Cyclomatic Complexity · ConstantEvaluator · ×4
  • ConstantEvaluator::cast (cyclomatic 119) naga/src/proc/constant_evaluator.rs:2486 — ConstantEvaluator::cast has cyclomatic complexity 119 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ConstantEvaluator::binary_op (cyclomatic 119) naga/src/proc/constant_evaluator.rs:2858 — ConstantEvaluator::binary_op has cyclomatic complexity 119 (threshold 15). Of this number, 116 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ConstantEvaluator::math (cyclomatic 93) naga/src/proc/constant_evaluator.rs:1489 — ConstantEvaluator::math has cyclomatic complexity 93 (threshold 15). Of this number, 86 points are the body's own statements and 7 belong to 4 function items inside it that branch. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ConstantEvaluator::unary_op (cyclomatic 23) naga/src/proc/constant_evaluator.rs:2800 — ConstantEvaluator::unary_op has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: ConstantEvaluator::try_eval_and_append_impl (cyclomatic 30) 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 function is counted neither in this dimension's figures nor in its score.
D2 · Cognitive Complexity · Queue · ×4
  • Queue::process (cognitive 213) wgpu-hal/src/gles/queue.rs:192 — Queue::process has cognitive complexity 213 (threshold 15). Drivers by points: if/else 85 (155 pts), match/switch 14 (27 pts), loops 8 (22 pts), boolean chains 9 (nesting depth added 97). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Queue::submit_inner (cognitive 54) wgpu-core/src/device/queue.rs:1624 — Queue::submit_inner has cognitive complexity 54 (threshold 15). Drivers by points: if/else 13 (40 pts), match/switch 5 (9 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Queue::copy_external_image_to_texture (cognitive 22) wgpu-core/src/device/queue.rs:1346 — Queue::copy_external_image_to_texture has cognitive complexity 22 (threshold 15). Drivers by points: if/else 16 (17 pts), boolean chains 3, loops 1 (2 pts) (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.
  • Queue::write_texture_inner (cognitive 21) wgpu-core/src/device/queue.rs:1085 — Queue::write_texture_inner has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (13 pts), loops 3 (7 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · Adapter · ×4
  • Adapter::expose (cognitive 137) wgpu-hal/src/gles/adapter.rs:195 — Adapter::expose has cognitive complexity 137 (threshold 15). Drivers by points: if/else 78 (91 pts), boolean chains 45, match/switch 1 (nesting depth added 13). 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.
  • Adapter::expose (cognitive 106) wgpu-hal/src/dx12/adapter.rs:65 — Adapter::expose has cognitive complexity 106 (threshold 15). Drivers by points: if/else 59 (68 pts), boolean chains 20, match/switch 11 (17 pts), loops 1 (nesting depth added 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • Adapter::device_from_raw (cognitive 56) wgpu-hal/src/vulkan/adapter.rs:2647 — Adapter::device_from_raw has cognitive complexity 56 (threshold 15). Drivers by points: if/else 51, boolean chains 4, match/switch 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.
  • Adapter::texture_format_capabilities (cognitive 47) wgpu-hal/src/metal/adapter.rs:176 — Adapter::texture_format_capabilities has cognitive complexity 47 (threshold 15). Drivers by points: if/else 30 (44 pts), match/switch 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.
D2 · Cognitive Complexity · Instance · ×4
  • Instance::init_with_callback (cognitive 35) wgpu-hal/src/vulkan/instance.rs:765 — Instance::init_with_callback has cognitive complexity 35 (threshold 15). Drivers by points: if/else 22 (28 pts), boolean chains 4, match/switch 2 (3 pts) (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • Instance::request_adapter (cognitive 31) wgpu-core/src/instance.rs:472 — Instance::request_adapter has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (26 pts), loops 2 (3 pts), match/switch 2 (nesting depth added 13). Of this number, 30 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Instance::enumerate_adapters (cognitive 24) wgpu-hal/src/vulkan/instance.rs:1156 — Instance::enumerate_adapters has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (18 pts), boolean chains 3, loops 1 (2 pts), match/switch 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.
  • Instance::expose_adapter (cognitive 24) wgpu-hal/src/vulkan/adapter.rs:2282 — Instance::expose_adapter has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 10, match/switch 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.
D2 · Cognitive Complexity · wgpu_hal · ×4
  • wgpu_hal::gles::egl::choose_config (cognitive 23) wgpu-hal/src/gles/egl.rs:93 — wgpu_hal::gles::egl::choose_config has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 3 (6 pts), match/switch 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.
  • wgpu_hal::vulkan::instance::debug_utils_messenger_callback (cognitive 22) wgpu-hal/src/vulkan/instance.rs:18 — wgpu_hal::vulkan::instance::debug_utils_messenger_callback has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 4, match/switch 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.
  • wgpu_hal::auxil::dxgi::hdr::output_desc1_from_factory (cognitive 21) wgpu-hal/src/auxil/dxgi/hdr.rs:188 — wgpu_hal::auxil::dxgi::hdr::output_desc1_from_factory has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 5 (14 pts), if/else 2 (4 pts), loops 2 (3 pts) (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • wgpu_hal::dx12::adapter::get_adapter_pci_info (cognitive 17) wgpu-hal/src/dx12/adapter.rs:1410 — wgpu_hal::dx12::adapter::get_adapter_pci_info has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 1, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D3 · God Classes · TooManyFields · ×4
  • TooManyFields: CapabilitiesQuery wgpu-hal/src/metal/mod.rs:228 — TooManyFields — 107 stored fields beside 7 methods. The bar is 30 stored fields; this is 77 over it, 3.57× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: Limits wgpu-types/src/limits.rs:146 — TooManyFields — 61 stored fields beside 15 methods. The bar is 30 stored fields; this is 31 over it, 2.03× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: Writer naga/src/back/spv/mod.rs:920 — TooManyFields — 39 stored fields beside 97 methods. The bar is 30 stored fields; this is 9 over it, 1.30× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: Device wgpu-core/src/device/resource.rs:235 — TooManyFields — 31 stored fields beside 102 methods. The bar is 30 stored fields; this is 1 over it, 1.03× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
D4 · Code Duplication · Duplicated block (20 lines × 2) · ×4
  • Duplicated block (20 lines × 2) naga/src/back/hlsl/help.rs:1617 — naga/src/back/hlsl/help.rs:1617-1636 | naga/src/back/hlsl/help.rs:1682-1701 — both copies are in the same file, so extract the 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) wgpu-core/src/command/bundle.rs:467 — wgpu-core/src/command/bundle.rs:467-486 | wgpu-core/src/command/render.rs:2465-2484 — before extracting anything, compare `wgpu-core/src/command/bundle.rs` and `wgpu-core/src/command/render.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 83 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 lines × 2) wgpu-core/src/command/ray_tracing.rs:610 — wgpu-core/src/command/ray_tracing.rs:610-629 | wgpu-core/src/command/ray_tracing.rs:955-974 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (20 lines × 2) wgpu-hal/src/gles/egl.rs:1171 — wgpu-hal/src/gles/egl.rs:1171-1190 | wgpu-hal/src/gles/wgl.rs:718-737 — before extracting anything, compare `wgpu-hal/src/gles/egl.rs` and `wgpu-hal/src/gles/wgl.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 73 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (17–18 lines × 2) · ×4
  • Duplicated block (17–18 lines × 2) naga/src/back/glsl/conv.rs:140 — naga/src/back/glsl/conv.rs:140-156 | naga/src/back/msl/mod.rs:693-710 — 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) wgpu-core/src/command/memory_init.rs:397 — wgpu-core/src/command/memory_init.rs:397-414 | wgpu-core/src/command/memory_init.rs:475-491 — both copies are in the same file, so extract the 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–18 lines × 2) wgpu-core/src/command/ray_tracing.rs:709 — wgpu-core/src/command/ray_tracing.rs:709-725 | wgpu-core/src/command/ray_tracing.rs:998-1015 — both copies are in the same file, so extract the 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–18 lines × 2) wgpu-core/src/track/texture.rs:1282 — wgpu-core/src/track/texture.rs:1282-1299 | wgpu-core/src/track/texture.rs:1318-1334 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (9 lines × 3) · ×4
  • Duplicated block (9 lines × 3) deno_webgpu/webidl.rs:46 — deno_webgpu/webidl.rs:46-54 | deno_webgpu/webidl.rs:156-164 | deno_webgpu/webidl.rs:251-259 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (9 lines × 3) naga/src/back/glsl/writer.rs:2268 — naga/src/back/glsl/writer.rs:2268-2276 | naga/src/back/msl/writer.rs:4413-4421 | naga/src/back/wgsl/writer.rs:1205-1213 — `naga/src/back/glsl/writer.rs` and `naga/src/back/msl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 66 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (9 lines × 3) naga/src/front/glsl/parser.rs:270 — naga/src/front/glsl/parser.rs:270-278 | naga/src/front/glsl/parser.rs:293-301 | naga/src/front/glsl/parser.rs:377-385 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (9 lines × 3) wgpu-hal/src/gles/queue.rs:1821 — wgpu-hal/src/gles/queue.rs:1821-1829 | wgpu-hal/src/gles/queue.rs:1855-1863 | wgpu-hal/src/gles/queue.rs:1890-1898 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D6 · Cohesion (LCOM4) · Low cohesion · ×4
  • Low cohesion: Device (LCOM4 9) wgpu-hal/src/dx12/mod.rs:653 — Device'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: Handle (LCOM4 4) naga/src/arena/handle.rs:44 — Handle'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: Device (LCOM4 4) wgpu-core/src/device/resource.rs:235 — Device'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: Limits (LCOM4 4) wgpu-types/src/limits.rs:146 — Limits's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
D1 · Cyclomatic Complexity · Queue · ×3
  • Queue::process (cyclomatic 177) wgpu-hal/src/gles/queue.rs:192 — Queue::process has cyclomatic complexity 177 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Queue::submit_inner (cyclomatic 24) wgpu-core/src/device/queue.rs:1624 — Queue::submit_inner 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.
  • Queue::copy_external_image_to_texture (cyclomatic 18) wgpu-core/src/device/queue.rs:1346 — Queue::copy_external_image_to_texture has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Parser · ×3
  • Parser::global_decl (cyclomatic 53) naga/src/front/wgsl/parse/mod.rs:1839 — Parser::global_decl has cyclomatic complexity 53 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Parser::statement (cyclomatic 31) naga/src/front/wgsl/parse/mod.rs:1255 — Parser::statement 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.
  • Parser::equality_expression (cyclomatic 18) naga/src/front/wgsl/parse/mod.rs:701 — Parser::equality_expression has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: Parser::primary_expression (cyclomatic 24) 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 function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · ParsingContext · ×3
  • ParsingContext::parse_statement (cyclomatic 45) naga/src/front/glsl/parser/functions.rs:41 — ParsingContext::parse_statement 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.
  • ParsingContext::parse_type_qualifiers (cyclomatic 22) naga/src/front/glsl/parser/types.rs:169 — ParsingContext::parse_type_qualifiers 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. This is NOT this file's highest cyclomatic complexity: naga::front::glsl::parser::types::map_image_format (cyclomatic 41) 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 function is counted neither in this dimension's figures nor in its score.
  • ParsingContext::parse_declaration (cyclomatic 20) naga/src/front/glsl/parser/declarations.rs:294 — ParsingContext::parse_declaration has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PhysicalDeviceFeatures · ×3
  • PhysicalDeviceFeatures::from_extensions_and_requested_features (cyclomatic 39) wgpu-hal/src/vulkan/adapter.rs:276 — PhysicalDeviceFeatures::from_extensions_and_requested_features 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.
  • PhysicalDeviceFeatures::to_wgpu (cyclomatic 39) wgpu-hal/src/vulkan/adapter.rs:666 — PhysicalDeviceFeatures::to_wgpu has cyclomatic complexity 39 (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.
  • PhysicalDeviceFeatures::add_to_device_create (cyclomatic 27) wgpu-hal/src/vulkan/adapter.rs:157 — PhysicalDeviceFeatures::add_to_device_create has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Instance · ×3
  • Instance::expose_adapter (cyclomatic 25) wgpu-hal/src/vulkan/adapter.rs:2282 — Instance::expose_adapter has cyclomatic complexity 25 (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.
  • Instance::init_with_callback (cyclomatic 25) wgpu-hal/src/vulkan/instance.rs:765 — Instance::init_with_callback 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.
  • Instance::request_adapter (cyclomatic 21) wgpu-core/src/instance.rs:472 — Instance::request_adapter has cyclomatic complexity 21 (threshold 15). Of this number, 15 points are the body's own statements and 6 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D2 · Cognitive Complexity · PhysicalDeviceFeatures · ×3
  • PhysicalDeviceFeatures::from_extensions_and_requested_features (cognitive 64) wgpu-hal/src/vulkan/adapter.rs:276 — PhysicalDeviceFeatures::from_extensions_and_requested_features has cognitive complexity 64 (threshold 15). Drivers by points: if/else 52, boolean chains 11, match/switch 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.
  • PhysicalDeviceFeatures::to_wgpu (cognitive 39) wgpu-hal/src/vulkan/adapter.rs:666 — PhysicalDeviceFeatures::to_wgpu has cognitive complexity 39 (threshold 15). Drivers by points: boolean chains 22, if/else 16 (17 pts) (nesting depth added 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.
  • PhysicalDeviceFeatures::add_to_device_create (cognitive 26) wgpu-hal/src/vulkan/adapter.rs:157 — PhysicalDeviceFeatures::add_to_device_create 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.
D2 · Cognitive Complexity · FunctionInfo · ×3
  • FunctionInfo::process_block (cognitive 62) naga/src/valid/analyzer.rs:879 — FunctionInfo::process_block has cognitive complexity 62 (threshold 15). Drivers by points: if/else 13 (37 pts), loops 5 (13 pts), match/switch 4 (11 pts), boolean chains 1 (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.
  • FunctionInfo::process_expression (cognitive 42) naga/src/valid/analyzer.rs:531 — FunctionInfo::process_expression has cognitive complexity 42 (threshold 15). Drivers by points: match/switch 10 (25 pts), if/else 9 (16 pts), boolean chains 1 (nesting depth added 22). 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.
  • FunctionInfo::process_call (cognitive 16) naga/src/valid/analyzer.rs:439 — FunctionInfo::process_call has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), match/switch 3 (6 pts), 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.
D2 · Cognitive Complexity · Parser · ×3
  • Parser::statement (cognitive 47) naga/src/front/wgsl/parse/mod.rs:1255 — Parser::statement has cognitive complexity 47 (threshold 15). Drivers by points: if/else 12 (31 pts), loops 4 (10 pts), match/switch 3 (5 pts), boolean chains 1 (nesting depth added 27). 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.
  • Parser::global_decl (cognitive 46) naga/src/front/wgsl/parse/mod.rs:1839 — Parser::global_decl has cognitive complexity 46 (threshold 15). Drivers by points: if/else 16 (29 pts), match/switch 6 (12 pts), loops 2 (4 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.
  • Parser::parse (cognitive 25) naga/src/front/wgsl/parse/mod.rs:2242 — Parser::parse has cognitive complexity 25 (threshold 15). Drivers by points: match/switch 4 (13 pts), if/else 4 (10 pts), loops 2 (nesting depth added 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D4 · Code Duplication · Duplicated block (23 lines × 2) · ×3
  • Duplicated block (23 lines × 2) naga/src/back/hlsl/writer.rs:5016 — naga/src/back/hlsl/writer.rs:5016-5038 | naga/src/back/hlsl/writer.rs:5074-5096 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (23 lines × 2) naga/src/front/glsl/builtins.rs:1015 — naga/src/front/glsl/builtins.rs:1015-1037 | naga/src/front/glsl/builtins.rs:1165-1187 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (23 lines × 2) wgpu-core/src/device/queue.rs:1167 — wgpu-core/src/device/queue.rs:1167-1189 | wgpu-core/src/device/queue.rs:1453-1475 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (17 lines × 2) · ×3
  • Duplicated block (17 lines × 2) naga/src/back/spv/writer.rs:2816 — naga/src/back/spv/writer.rs:2816-2832 | naga/src/back/spv/writer.rs:2848-2864 — both copies are in the same file, so extract the 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) naga/src/front/glsl/functions.rs:1238 — naga/src/front/glsl/functions.rs:1238-1254 | naga/src/front/glsl/functions.rs:1291-1307 — both copies are in the same file, so extract the 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) naga/src/valid/interface.rs:595 — naga/src/valid/interface.rs:595-611 | naga/src/valid/interface.rs:613-629 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (15–16 lines × 2) · ×3
  • Duplicated block (15–16 lines × 2) naga/src/front/spv/next_block.rs:501 — naga/src/front/spv/next_block.rs:501-515 | naga/src/front/spv/next_block.rs:568-583 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15–16 lines × 2) wgpu-core/src/device/resource.rs:2701 — wgpu-core/src/device/resource.rs:2701-2715 | wgpu-core/src/device/resource.rs:2860-2875 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15–16 lines × 2) wgpu-core/src/track/texture.rs:579 — wgpu-core/src/track/texture.rs:579-594 | wgpu-core/src/track/texture.rs:620-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.
D4 · Code Duplication · Duplicated block (10 lines × 3) · ×3
  • Duplicated block (10 lines × 3) naga/src/back/hlsl/writer.rs:3384 — naga/src/back/hlsl/writer.rs:3384-3393 | naga/src/back/hlsl/writer.rs:3416-3425 | naga/src/back/hlsl/writer.rs:3429-3438 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (10 lines × 3) naga/src/back/glsl/mod.rs:102 — naga/src/back/glsl/mod.rs:102-111 | naga/src/back/hlsl/mod.rs:234-243 | naga/src/back/msl/mod.rs:135-144 — 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 (10 lines × 3) naga/src/back/msl/writer.rs:5089 — naga/src/back/msl/writer.rs:5089-5098 | naga/src/back/msl/writer.rs:5280-5292 | naga/src/back/msl/writer.rs:5701-5713 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D1 · Cyclomatic Complexity · Interface · ×2
  • Interface::check_stage (cyclomatic 85) wgpu-core/src/validation.rs:1588 — Interface::check_stage has cyclomatic complexity 85 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Interface::new (cyclomatic 18) wgpu-core/src/validation.rs:1374 — Interface::new 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. This is NOT this file's highest cyclomatic complexity: Interface::populate (cyclomatic 59) 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 function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · FeaturesManager · ×2
  • FeaturesManager::check_availability (cyclomatic 69) naga/src/back/glsl/features.rs:96 — FeaturesManager::check_availability has cyclomatic complexity 69 (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.
  • FeaturesManager::write (cyclomatic 42) naga/src/back/glsl/features.rs:163 — FeaturesManager::write has cyclomatic complexity 42 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · FunctionInfo · ×2
  • FunctionInfo::process_expression (cyclomatic 51) naga/src/valid/analyzer.rs:531 — FunctionInfo::process_expression has cyclomatic complexity 51 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • FunctionInfo::process_block (cyclomatic 45) naga/src/valid/analyzer.rs:879 — FunctionInfo::process_block has cyclomatic complexity 45 (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.
D1 · Cyclomatic Complexity · Resource · ×2
  • Resource::check_binding_use (cyclomatic 35) wgpu-core/src/validation.rs:692 — Resource::check_binding_use has cyclomatic complexity 35 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: Interface::populate (cyclomatic 59) 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 function is counted neither in this dimension's figures nor in its score.
  • Resource::derive_binding_type (cyclomatic 22) wgpu-core/src/validation.rs:894 — Resource::derive_binding_type has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: Interface::populate (cyclomatic 59) 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 function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · Surface · ×2
  • Surface::configure (cyclomatic 19) wgpu-hal/src/metal/surface.rs:250 — Surface::configure has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Surface::configure (cyclomatic 18) wgpu-hal/src/gles/egl.rs:1243 — Surface::configure has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D17 · Explicit Debt · XxxComment · ×2
  • XxxComment wgpu-types/src/counters.rs:185 — // XXX: Rename to total_capacity_bytes following the rename at https://github.com/Traverse-Research/gpu-allocator/pull/266?
  • XxxComment wgpu-hal/examples/raw-gles.rs:236 — // XXX: On WGL this should only be called after the context was — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
D2 · Cognitive Complexity · Interface · ×2
  • Interface::check_stage (cognitive 151) wgpu-core/src/validation.rs:1588 — Interface::check_stage has cognitive complexity 151 (threshold 15). Drivers by points: if/else 44 (92 pts), match/switch 15 (36 pts), loops 9 (16 pts), boolean chains 7 (nesting depth added 76). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Interface::new (cognitive 27) wgpu-core/src/validation.rs:1374 — Interface::new has cognitive complexity 27 (threshold 15). Drivers by points: if/else 4 (9 pts), match/switch 4 (9 pts), loops 5 (8 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · VaryingContext · ×2
  • VaryingContext::validate_impl (cognitive 140) naga/src/valid/interface.rs:234 — VaryingContext::validate_impl has cognitive complexity 140 (threshold 15). Drivers by points: match/switch 29 (58 pts), if/else 26 (53 pts), boolean chains 29 (nesting depth added 56). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • VaryingContext::validate (cognitive 28) naga/src/valid/interface.rs:846 — VaryingContext::validate has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (19 pts), match/switch 2 (5 pts), loops 1 (3 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.
D2 · Cognitive Complexity · wgpu_xtask · ×2
  • wgpu_xtask::cts::run_cts (cognitive 74) xtask/src/cts.rs:66 — wgpu_xtask::cts::run_cts has cognitive complexity 74 (threshold 15). Drivers by points: if/else 41 (59 pts), boolean chains 8, match/switch 2 (4 pts), loops 3 (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.
  • wgpu_xtask::vendor_web_sys::run_vendor_web_sys (cognitive 18) xtask/src/vendor_web_sys.rs:156 — wgpu_xtask::vendor_web_sys::run_vendor_web_sys has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (15 pts), loops 2, match/switch 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.
D2 · Cognitive Complexity · FeaturesManager · ×2
  • FeaturesManager::check_availability (cognitive 69) naga/src/back/glsl/features.rs:96 — FeaturesManager::check_availability has cognitive complexity 69 (threshold 15). Drivers by points: boolean chains 44, if/else 24, match/switch 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.
  • FeaturesManager::write (cognitive 49) naga/src/back/glsl/features.rs:163 — FeaturesManager::write has cognitive complexity 49 (threshold 15). Drivers by points: if/else 29 (36 pts), boolean chains 11, match/switch 1 (2 pts) (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Module · ×2
  • Module::analyze_mesh_shader_info (cognitive 65) naga/src/proc/mod.rs:757 — Module::analyze_mesh_shader_info has cognitive complexity 65 (threshold 15). Drivers by points: if/else 9 (32 pts), match/switch 6 (25 pts), loops 2 (8 pts) (nesting depth added 48). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Module::uses_mesh_shaders (cognitive 18) naga/src/proc/mod.rs:920 — Module::uses_mesh_shaders has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 4 (7 pts), match/switch 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.
D2 · Cognitive Complexity · Resource · ×2
  • Resource::check_binding_use (cognitive 51) wgpu-core/src/validation.rs:692 — Resource::check_binding_use has cognitive complexity 51 (threshold 15). Drivers by points: match/switch 13 (31 pts), if/else 8 (17 pts), boolean chains 3 (nesting depth added 27). 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.
  • Resource::derive_binding_type (cognitive 16) wgpu-core/src/validation.rs:894 — Resource::derive_binding_type has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 6 (13 pts), if/else 2 (3 pts) (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Namer · ×2
  • Namer::reset (cognitive 47) naga/src/proc/namer.rs:235 — Namer::reset has cognitive complexity 47 (threshold 15). Drivers by points: loops 14 (25 pts), if/else 5 (12 pts), match/switch 4 (10 pts) (nesting depth added 24). 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.
  • Namer::sanitize (cognitive 23) naga/src/proc/namer.rs:110 — Namer::sanitize has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 5, match/switch 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.
D2 · Cognitive Complexity · BakedCommands · ×2
  • BakedCommands::initialize_texture_memory (cognitive 23) wgpu-core/src/command/memory_init.rs:350 — BakedCommands::initialize_texture_memory has cognitive complexity 23 (threshold 15). Drivers by points: loops 6 (14 pts), if/else 4 (7 pts), match/switch 1 (2 pts) (nesting depth added 12). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • BakedCommands::initialize_buffer_memory (cognitive 17) wgpu-core/src/command/memory_init.rs:236 — BakedCommands::initialize_buffer_memory has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (6 pts), loops 4 (6 pts), match/switch 2 (5 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · wgpu_info · ×2
  • wgpu_info::human::print_adapter (cognitive 19) wgpu-info/src/human.rs:80 — wgpu_info::human::print_adapter has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 6 (8 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • wgpu_info::cli::main (cognitive 16) wgpu-info/src/cli.rs:31 — wgpu_info::cli::main has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (11 pts), loops 2 (3 pts), match/switch 2 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · Surface · ×2
  • Surface::configure (cognitive 17) wgpu-hal/src/dx12/mod.rs:1374 — Surface::configure has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), match/switch 5 (7 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.
  • Surface::configure (cognitive 16) wgpu-hal/src/metal/surface.rs:250 — Surface::configure has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), match/switch 3, 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.
D35 · Change Coupling · Change coupling · ×2
  • Change coupling: buffer.rs ↔ texture.rs wgpu-core/src/track/buffer.rs:1 — `wgpu-core/src/track/buffer.rs` and `wgpu-core/src/track/texture.rs` change together 68% of the time (36 of the 53 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 36 shared commits counted here, the most recent 3 are `fc1aa76b` fix(core): Don't use `{buffer,texture}_init_actions` for usage tracking; `62c2f5da` Move ordered usages to hals (#8924); `71820eef` Fix performance regression in bind group processing (#8519) — run `git show` on any of them.
  • Change coupling: buffer.rs ↔ stateless.rs wgpu-core/src/track/buffer.rs:1 — `wgpu-core/src/track/buffer.rs` and `wgpu-core/src/track/stateless.rs` change together 56% of the time (15 of the 27 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 15 shared commits counted here, the most recent 3 are `3a5ad193` remove all internal `BindGroupState` `Mutex`es; `4f020573` Convert some module doc comments; `3c3b532c` Remove latest_submission_index (#5976) — run `git show` on any of them.
D4 · Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) · ×2
  • Members sharing a duplicated core (4 members, 50+ identical tokens) naga/src/back/hlsl/help.rs:967 — naga/src/back/hlsl/help.rs:967-972 | naga/src/back/hlsl/help.rs:1031-1036 | naga/src/back/hlsl/help.rs:1091-1096 | naga/src/back/hlsl/help.rs:1169-1174 — 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) naga/src/front/spv/mod.rs:2134 — naga/src/front/spv/mod.rs:2134-2154 | naga/src/front/spv/mod.rs:2160-2189 | naga/src/front/spv/mod.rs:2195-2216 | naga/src/front/spv/mod.rs:2222-2252 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Duplicated block (42 lines × 2) · ×2
  • Duplicated block (42 lines × 2) naga/src/back/spv/mesh_shader.rs:188 — naga/src/back/spv/mesh_shader.rs:188-229 | naga/src/back/spv/mesh_shader.rs:268-309 — both copies are in the same file, so extract the 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 (42 lines × 2) wgpu-core/src/track/blas.rs:17 — wgpu-core/src/track/blas.rs:17-58 | wgpu-core/src/track/query_set.rs:17-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.
D4 · Code Duplication · Duplicated block (29 lines × 2) · ×2
  • Duplicated block (29 lines × 2) naga/src/back/spv/block.rs:935 — naga/src/back/spv/block.rs:935-963 | naga/src/back/spv/block.rs:1026-1054 — both copies are in the same file, so extract the 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 (29 lines × 2) naga/src/front/glsl/builtins.rs:934 — naga/src/front/glsl/builtins.rs:934-962 | naga/src/front/glsl/builtins.rs:1091-1119 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (26 lines × 2) · ×2
  • Duplicated block (26 lines × 2) naga/src/front/spv/image.rs:861 — naga/src/front/spv/image.rs:861-886 | naga/src/front/spv/image.rs:906-931 — both copies are in the same file, so extract the 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) wgpu-core/src/command/bundle.rs:1113 — wgpu-core/src/command/bundle.rs:1113-1138 | wgpu-core/src/command/render.rs:2923-2948 — before extracting anything, compare `wgpu-core/src/command/bundle.rs` and `wgpu-core/src/command/render.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 83 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (19–20 lines × 2) · ×2
  • Duplicated block (19–20 lines × 2) naga/src/back/spv/block.rs:862 — naga/src/back/spv/block.rs:862-880 | naga/src/back/spv/block.rs:989-1008 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (19–20 lines × 2) naga/src/front/glsl/context.rs:662 — naga/src/front/glsl/context.rs:662-681 | naga/src/front/glsl/context.rs:724-742 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (19 lines × 2) · ×2
  • Duplicated block (19 lines × 2) naga/src/back/hlsl/writer.rs:2244 — naga/src/back/hlsl/writer.rs:2244-2262 | naga/src/back/wgsl/writer.rs:802-820 — `naga/src/back/hlsl/writer.rs` and `naga/src/back/wgsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 18 separate duplicated blocks between them, totalling at least 185 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) wgpu-core/src/track/texture.rs:847 — wgpu-core/src/track/texture.rs:847-865 | wgpu-core/src/track/texture.rs:887-905 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (17 lines × 3) · ×2
  • Duplicated block (17 lines × 3) wgpu-hal/src/dx12/suballocation.rs:292 — wgpu-hal/src/dx12/suballocation.rs:292-308 | wgpu-hal/src/dx12/suballocation.rs:331-347 | wgpu-hal/src/dx12/suballocation.rs:370-386 — 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 (17 lines × 3) wgpu-hal/src/gles/egl.rs:1478 — wgpu-hal/src/gles/egl.rs:1478-1494 | wgpu-hal/src/gles/web.rs:471-487 | wgpu-hal/src/gles/wgl.rs:884-900 — before extracting anything, compare `wgpu-hal/src/gles/egl.rs` and `wgpu-hal/src/gles/wgl.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 73 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (12–17 lines × 2) · ×2
  • Duplicated block (12–17 lines × 2) naga/src/back/glsl/writer.rs:3724 — naga/src/back/glsl/writer.rs:3724-3735 | naga/src/back/glsl/writer.rs:3737-3753 — both copies are in the same file, so extract the 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–17 lines × 2) wgpu-core/src/device/resource.rs:3580 — wgpu-core/src/device/resource.rs:3580-3596 | wgpu-core/src/device/resource.rs:3697-3708 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (12–16 lines × 2) · ×2
  • Duplicated block (12–16 lines × 2) naga/src/back/wgsl/writer.rs:2067 — naga/src/back/wgsl/writer.rs:2067-2082 | naga/src/back/wgsl/writer.rs:2124-2135 — both copies are in the same file, so extract the 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–16 lines × 2) wgpu-core/src/device/resource.rs:4585 — wgpu-core/src/device/resource.rs:4585-4596 | wgpu-core/src/device/resource.rs:5344-5359 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (12–15 lines × 2) · ×2
  • Duplicated block (12–15 lines × 2) naga/src/back/msl/writer.rs:3129 — naga/src/back/msl/writer.rs:3129-3143 | naga/src/back/msl/writer.rs:3148-3159 — both copies are in the same file, so extract the 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–15 lines × 2) naga/src/back/spv/block.rs:2914 — naga/src/back/spv/block.rs:2914-2925 | naga/src/back/spv/block.rs:3880-3894 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (14–15 lines × 2) · ×2
  • Duplicated block (14–15 lines × 2) naga/src/front/spv/next_block.rs:917 — naga/src/front/spv/next_block.rs:917-930 | naga/src/front/spv/next_block.rs:999-1013 — both copies are in the same file, so extract the 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) wgpu-hal/src/dx12/command.rs:228 — wgpu-hal/src/dx12/command.rs:228-242 | wgpu-hal/src/dx12/command.rs:254-267 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (13 lines × 3) · ×2
  • Duplicated block (13 lines × 3) naga/src/back/glsl/writer.rs:2482 — naga/src/back/glsl/writer.rs:2482-2494 | naga/src/back/hlsl/writer.rs:4112-4124 | naga/src/back/wgsl/writer.rs:1583-1595 — `naga/src/back/glsl/writer.rs` and `naga/src/back/hlsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 86 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (13 lines × 3) naga/src/back/msl/writer.rs:5129 — naga/src/back/msl/writer.rs:5129-5141 | naga/src/back/msl/writer.rs:5337-5349 | naga/src/back/msl/writer.rs:5799-5811 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (7–10 lines × 2) · ×2
  • Duplicated block (7–10 lines × 2) naga/src/back/spv/block.rs:3906 — naga/src/back/spv/block.rs:3906-3915 | naga/src/back/spv/block.rs:4262-4268 — both copies are in the same file, so extract the 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–10 lines × 2) wgpu-core/src/command/bundle.rs:1051 — wgpu-core/src/command/bundle.rs:1051-1057 | wgpu-core/src/command/render.rs:2832-2841 — before extracting anything, compare `wgpu-core/src/command/bundle.rs` and `wgpu-core/src/command/render.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 83 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (8–9 lines × 2) · ×2
  • Duplicated block (8–9 lines × 2) naga/src/back/wgsl/writer.rs:864 — naga/src/back/wgsl/writer.rs:864-871 | naga/src/back/wgsl/writer.rs:885-893 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8–9 lines × 2) naga/src/front/spv/next_block.rs:736 — naga/src/front/spv/next_block.rs:736-744 | naga/src/front/spv/next_block.rs:774-781 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (7–8 lines × 3) · ×2
  • Duplicated block (7–8 lines × 3) naga/src/back/glsl/writer.rs:2395 — naga/src/back/glsl/writer.rs:2395-2402 | naga/src/back/hlsl/writer.rs:3701-3707 | naga/src/back/wgsl/writer.rs:1471-1478 — `naga/src/back/glsl/writer.rs` and `naga/src/back/hlsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 86 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–8 lines × 3) naga/src/front/spv/mod.rs:1476 — naga/src/front/spv/mod.rs:1476-1483 | naga/src/front/spv/next_block.rs:2840-2846 | naga/src/front/spv/next_block.rs:2900-2906 — before extracting anything, compare `naga/src/front/spv/mod.rs` and `naga/src/front/spv/next_block.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (8 lines × 3) · ×2
  • Duplicated block (8 lines × 3) wgpu-hal/src/gles/egl.rs:1416 — wgpu-hal/src/gles/egl.rs:1416-1423 | wgpu-hal/src/gles/web.rs:415-423 | wgpu-hal/src/gles/wgl.rs:809-817 — before extracting anything, compare `wgpu-hal/src/gles/egl.rs` and `wgpu-hal/src/gles/wgl.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 73 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 3) wgpu-hal/src/metal/command.rs:329 — wgpu-hal/src/metal/command.rs:329-336 | wgpu-hal/src/metal/command.rs:400-407 | wgpu-hal/src/metal/command.rs:415-422 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (7–8 lines × 2) · ×2
  • Duplicated block (7–8 lines × 2) naga/src/front/spv/mod.rs:2766 — naga/src/front/spv/mod.rs:2766-2772 | naga/src/front/spv/mod.rs:2842-2849 — both copies are in the same file, so extract the 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–8 lines × 2) naga/src/front/wgsl/lower/mod.rs:3342 — naga/src/front/wgsl/lower/mod.rs:3342-3348 | naga/src/front/wgsl/lower/mod.rs:3550-3557 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (7 lines × 3) · ×2
  • Duplicated block (7 lines × 3) naga/src/front/wgsl/lower/mod.rs:3393 — naga/src/front/wgsl/lower/mod.rs:3393-3399 | naga/src/front/wgsl/lower/mod.rs:3529-3535 | naga/src/front/wgsl/lower/mod.rs:3568-3574 — 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) naga/src/front/wgsl/lower/mod.rs:3738 — naga/src/front/wgsl/lower/mod.rs:3738-3744 | naga/src/front/wgsl/lower/mod.rs:3749-3755 | naga/src/front/wgsl/lower/mod.rs:3760-3766 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (6 lines × 5) · ×2
  • Duplicated block (6 lines × 5) naga/src/front/spv/mod.rs:1475 — naga/src/front/spv/mod.rs:1475-1480 | naga/src/front/spv/next_block.rs:861-869 | naga/src/front/spv/next_block.rs:2839-2844 | naga/src/front/spv/next_block.rs:2870-2875 | naga/src/front/spv/next_block.rs:2899-2904 — before extracting anything, compare `naga/src/front/spv/mod.rs` and `naga/src/front/spv/next_block.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 5) naga/src/front/spv/mod.rs:2161 — naga/src/front/spv/mod.rs:2161-2166 | naga/src/front/spv/mod.rs:2259-2264 | naga/src/front/spv/mod.rs:2314-2319 | naga/src/front/spv/mod.rs:2384-2389 | naga/src/front/spv/mod.rs:2628-2634 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (6 lines × 4) · ×2
  • Duplicated block (6 lines × 4) naga/src/back/msl/writer.rs:2266 — naga/src/back/msl/writer.rs:2266-2271 | naga/src/back/msl/writer.rs:2512-2517 | naga/src/back/msl/writer.rs:3097-3102 | naga/src/back/msl/writer.rs:4246-4251 — 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 (6 lines × 4) naga/src/front/spv/mod.rs:1128 — naga/src/front/spv/mod.rs:1128-1133 | naga/src/front/spv/mod.rs:1203-1208 | naga/src/front/spv/mod.rs:1273-1279 | naga/src/front/spv/next_block.rs:865-870 — before extracting anything, compare `naga/src/front/spv/mod.rs` and `naga/src/front/spv/next_block.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (5 lines × 5) · ×2
  • Duplicated block (5 lines × 5) naga/src/back/hlsl/writer.rs:4169 — naga/src/back/hlsl/writer.rs:4169-4173 | naga/src/back/wgsl/writer.rs:1237-1241 | naga/src/back/wgsl/writer.rs:1623-1627 | naga/src/back/wgsl/writer.rs:1933-1937 | naga/src/back/wgsl/writer.rs:2011-2015 — `naga/src/back/hlsl/writer.rs` and `naga/src/back/wgsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 18 separate duplicated blocks between them, totalling at least 185 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (5 lines × 5) naga/src/front/spv/next_block.rs:462 — naga/src/front/spv/next_block.rs:462-467 | naga/src/front/spv/next_block.rs:1073-1077 | naga/src/front/spv/next_block.rs:1270-1274 | naga/src/front/spv/next_block.rs:1512-1517 | naga/src/front/spv/next_block.rs:2364-2372 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (5 lines × 4) · ×2
  • Duplicated block (5 lines × 4) naga/src/back/glsl/writer.rs:2176 — naga/src/back/glsl/writer.rs:2176-2180 | naga/src/back/hlsl/writer.rs:2941-2945 | naga/src/back/msl/writer.rs:4328-4332 | naga/src/back/wgsl/writer.rs:1115-1119 — `naga/src/back/glsl/writer.rs` and `naga/src/back/hlsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 86 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (5 lines × 4) naga/src/back/hlsl/help.rs:968 — naga/src/back/hlsl/help.rs:968-972 | naga/src/back/hlsl/help.rs:1032-1036 | naga/src/back/hlsl/help.rs:1092-1096 | naga/src/back/hlsl/help.rs:1170-1174 — 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.
D1 · Cyclomatic Complexity · VaryingContext · ×1
  • VaryingContext::validate_impl (cyclomatic 133) naga/src/valid/interface.rs:234 — VaryingContext::validate_impl has cyclomatic complexity 133 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · CapabilitiesQuery · ×1
  • CapabilitiesQuery::new (cyclomatic 133) wgpu-hal/src/metal/adapter.rs:675 — CapabilitiesQuery::new has cyclomatic complexity 133 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Error · ×1
  • Error::as_parse_error (cyclomatic 123) naga/src/front/wgsl/error.rs:678 — Error::as_parse_error has cyclomatic complexity 123 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · PrivateCapabilities · ×1
  • PrivateCapabilities::map_texture_format (cyclomatic 122) wgpu-hal/src/vulkan/conv.rs:6 — PrivateCapabilities::map_texture_format has cyclomatic complexity 122 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · PrivateTextureFormatCapabilities · ×1
  • PrivateTextureFormatCapabilities::map_format (cyclomatic 120) wgpu-hal/src/metal/adapter.rs:1678 — PrivateTextureFormatCapabilities::map_format has cyclomatic complexity 120 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · ResolveContext · ×1
  • ResolveContext::resolve (cyclomatic 101) naga/src/proc/typifier.rs:265 — ResolveContext::resolve has cyclomatic complexity 101 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · Lexer · ×1
  • Lexer::next (cyclomatic 90) naga/src/front/glsl/lex.rs:46 — Lexer::next has cyclomatic complexity 90 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · TextureFormat · ×1
  • TextureFormat::guaranteed_format_features (cyclomatic 82) wgpu-types/src/texture/format.rs:914 — TextureFormat::guaranteed_format_features has cyclomatic complexity 82 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · StatementGraph · ×1
  • StatementGraph::add (cyclomatic 71) naga/src/back/dot/mod.rs:65 — StatementGraph::add has cyclomatic complexity 71 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · Context · ×1
  • Context::lower_inner (cyclomatic 71) naga/src/front/glsl/context.rs:544 — Context::lower_inner has cyclomatic complexity 71 (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.
D1 · Cyclomatic Complexity · RenderPassInfo · ×1
  • RenderPassInfo::start (cyclomatic 59) wgpu-core/src/command/render.rs:1219 — RenderPassInfo::start has cyclomatic complexity 59 (threshold 15). Of this number, 54 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · InstanceShared · ×1
  • InstanceShared::inspect (cyclomatic 59) wgpu-hal/src/vulkan/adapter.rs:1905 — InstanceShared::inspect has cyclomatic complexity 59 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Player · ×1
  • Player::process (cyclomatic 54) player/src/lib.rs:100 — Player::process has cyclomatic complexity 54 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · Texture · ×1
  • Texture::create_view_inner (cyclomatic 48) wgpu-core/src/resource.rs:1946 — Texture::create_view_inner has cyclomatic complexity 48 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PhysicalDeviceProperties · ×1
  • PhysicalDeviceProperties::get_required_extensions (cyclomatic 48) wgpu-hal/src/vulkan/adapter.rs:1230 — PhysicalDeviceProperties::get_required_extensions has cyclomatic complexity 48 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · wgpu_xtask · ×1
  • wgpu_xtask::cts::run_cts (cyclomatic 45) xtask/src/cts.rs:66 — wgpu_xtask::cts::run_cts 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.
D1 · Cyclomatic Complexity · ResolvedBinding · ×1
  • ResolvedBinding::try_fmt (cyclomatic 41) naga/src/back/msl/mod.rs:646 — ResolvedBinding::try_fmt has cyclomatic complexity 41 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · MacroCall · ×1
  • MacroCall::call (cyclomatic 41) naga/src/front/glsl/builtins.rs:1588 — MacroCall::call has cyclomatic complexity 41 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · TypeContext · ×1
  • TypeContext::fmt (cyclomatic 34) naga/src/back/msl/writer.rs:220 — TypeContext::fmt has cyclomatic complexity 34 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: Writer::write_unpacking_function (cyclomatic 43) 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 function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · ExpressionTracer · ×1
  • ExpressionTracer::trace_expression (cyclomatic 34) naga/src/compact/expressions.rs:76 — ExpressionTracer::trace_expression has cyclomatic complexity 34 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · FunctionTracer · ×1
  • FunctionTracer::trace_block (cyclomatic 33) naga/src/compact/statements.rs:9 — FunctionTracer::trace_block has cyclomatic complexity 33 (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. This shape REPEATS in the file: one other method here (FunctionMap::adjust_body) 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.
D1 · Cyclomatic Complexity · FunctionMap · ×1
  • FunctionMap::adjust_body (cyclomatic 33) naga/src/compact/statements.rs:239 — FunctionMap::adjust_body has cyclomatic complexity 33 (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. This shape REPEATS in the file: one other method here (FunctionTracer::trace_block) 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.
D1 · Cyclomatic Complexity · naga_cli · ×1
  • naga_cli::bin::naga::run (cyclomatic 31) naga-cli/src/bin/naga.rs:484 — naga_cli::bin::naga::run has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Inner · ×1
  • Inner::create (cyclomatic 29) wgpu-hal/src/gles/egl.rs:408 — Inner::create has cyclomatic complexity 29 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · player · ×1
  • player::bin::play::main (cyclomatic 27) player/src/bin/play.rs:4 — player::bin::play::main has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Namer · ×1
  • Namer::reset (cyclomatic 26) naga/src/proc/namer.rs:235 — Namer::reset has cyclomatic complexity 26 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D1 · Cyclomatic Complexity · RenderBundle · ×1
  • RenderBundle::execute (cyclomatic 26) wgpu-core/src/command/bundle.rs:1512 — RenderBundle::execute has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · wgpu_hal · ×1
  • wgpu_hal::vulkan::instance::debug_utils_messenger_callback (cyclomatic 23) wgpu-hal/src/vulkan/instance.rs:18 — wgpu_hal::vulkan::instance::debug_utils_messenger_callback has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · lock_analyzer · ×1
  • lock_analyzer::main (cyclomatic 22) lock-analyzer/src/main.rs:29 — lock_analyzer::main has cyclomatic complexity 22 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D1 · Cyclomatic Complexity · Module · ×1
  • Module::analyze_mesh_shader_info (cyclomatic 22) naga/src/proc/mod.rs:757 — Module::analyze_mesh_shader_info 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. This is NOT this file's highest cyclomatic complexity: MathFunction::argument_count (cyclomatic 79) 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 function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · Buffer · ×1
  • Buffer::try_map_async (cyclomatic 20) wgpu-core/src/resource.rs:823 — Buffer::try_map_async has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CoreDevice · ×1
  • CoreDevice::create_bind_group (cyclomatic 19) wgpu/src/backend/wgpu_core.rs:1042 — CoreDevice::create_bind_group has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Options · ×1
  • Options::resolve_local_binding (cyclomatic 17) naga/src/back/msl/mod.rs:468 — Options::resolve_local_binding has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WebCommandEncoder · ×1
  • WebCommandEncoder::begin_render_pass (cyclomatic 17) wgpu/src/backend/webgpu.rs:3450 — WebCommandEncoder::begin_render_pass has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: wgpu::backend::webgpu::map_texture_format (cyclomatic 97) 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 function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · LiteralVector · ×1
  • LiteralVector::from_literal_vec (cyclomatic 16) naga/src/proc/constant_evaluator.rs:345 — LiteralVector::from_literal_vec has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: ConstantEvaluator::try_eval_and_append_impl (cyclomatic 30) 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 function is counted neither in this dimension's figures nor in its score.
D15 · Churn × Complexity Hotspots · Repeated repair · ×1
  • Repeated repair: wgpu-core/src/command/memory_init.rs wgpu-core/src/command/memory_init.rs:350 — wgpu-core/src/command/memory_init.rs changed 4 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is BakedCommands::initialize_texture_memory at line 350), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(core): Init tracking for pass with multiple depth slice attachments”; “fix(core): Fix init tracking for 3D textures as render attachments”; “fix(core): Avoid overlapping locks in `initialize_texture_memory`”; “fix(core): Lose device on errors during critical part of submission”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 12:53:00 +00:00' --until='2026-10-25 12:53:00 +00:00' --full-history --no-merges -- wgpu-core/src/command/memory_init.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
D17 · Explicit Debt · TodoComment repeated across 17 files · ×1
  • TodoComment repeated across 17 files deno_webgpu/bind_group.rs:56 — The identical TodoComment appears in 17 files (19 occurrences) — almost certainly one boilerplate line from a single migration or decision, not 19 independent debts. Fix the systemic cause once rather than file-by-file. Text: "// TODO(@crowlKats): no-op, needs wpgu to implement changing the label". Source code is not a task system: track the cleanup where tasks live. (Every occurrence still counts toward the score and metrics.)
D2 · Cognitive Complexity · CapabilitiesQuery · ×1
  • CapabilitiesQuery::new (cognitive 158) wgpu-hal/src/metal/adapter.rs:675 — CapabilitiesQuery::new has cognitive complexity 158 (threshold 15). Drivers by points: if/else 79 (81 pts), boolean chains 75, loops 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Context · ×1
  • Context::lower_inner (cognitive 139) naga/src/front/glsl/context.rs:544 — Context::lower_inner has cognitive complexity 139 (threshold 15). Drivers by points: if/else 29 (66 pts), match/switch 21 (53 pts), loops 5 (18 pts), boolean chains 2 (nesting depth added 82). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · RenderPassInfo · ×1
  • RenderPassInfo::start (cognitive 107) wgpu-core/src/command/render.rs:1219 — RenderPassInfo::start has cognitive complexity 107 (threshold 15). Drivers by points: if/else 56 (92 pts), boolean chains 5, loops 3 (5 pts), match/switch 2 (5 pts) (nesting depth added 41). Of this number, 99 points are the body's own statements and 8 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InstanceShared · ×1
  • InstanceShared::inspect (cognitive 99) wgpu-hal/src/vulkan/adapter.rs:1905 — InstanceShared::inspect has cognitive complexity 99 (threshold 15). Drivers by points: if/else 43 (83 pts), boolean chains 16 (nesting depth added 40). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ResolveContext · ×1
  • ResolveContext::resolve (cognitive 89) naga/src/proc/typifier.rs:265 — ResolveContext::resolve has cognitive complexity 89 (threshold 15). Drivers by points: match/switch 22 (54 pts), if/else 14 (35 pts) (nesting depth added 53). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · StatementGraph · ×1
  • StatementGraph::add (cognitive 76) naga/src/back/dot/mod.rs:65 — StatementGraph::add has cognitive complexity 76 (threshold 15). Drivers by points: if/else 16 (38 pts), match/switch 8 (25 pts), loops 5 (13 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.
D2 · Cognitive Complexity · lock_analyzer · ×1
  • lock_analyzer::main (cognitive 55) lock-analyzer/src/main.rs:29 — lock_analyzer::main has cognitive complexity 55 (threshold 15). Drivers by points: loops 8 (23 pts), if/else 8 (19 pts), match/switch 3 (11 pts), boolean chains 2 (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PhysicalDeviceProperties · ×1
  • PhysicalDeviceProperties::get_required_extensions (cognitive 53) wgpu-hal/src/vulkan/adapter.rs:1230 — PhysicalDeviceProperties::get_required_extensions has cognitive complexity 53 (threshold 15). Drivers by points: if/else 46 (51 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.
D2 · Cognitive Complexity · Texture · ×1
  • Texture::create_view_inner (cognitive 51) wgpu-core/src/resource.rs:1946 — Texture::create_view_inner has cognitive complexity 51 (threshold 15). Drivers by points: if/else 31 (35 pts), boolean chains 9, match/switch 6 (7 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.
D2 · Cognitive Complexity · FunctionTracer · ×1
  • FunctionTracer::trace_block (cognitive 50) naga/src/compact/statements.rs:9 — FunctionTracer::trace_block has cognitive complexity 50 (threshold 15). Drivers by points: if/else 6 (24 pts), loops 5 (15 pts), match/switch 3 (11 pts) (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (FunctionMap::adjust_body) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · FunctionMap · ×1
  • FunctionMap::adjust_body (cognitive 50) naga/src/compact/statements.rs:239 — FunctionMap::adjust_body has cognitive complexity 50 (threshold 15). Drivers by points: if/else 6 (24 pts), loops 5 (15 pts), match/switch 3 (11 pts) (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (FunctionTracer::trace_block) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · MacroCall · ×1
  • MacroCall::call (cognitive 47) naga/src/front/glsl/builtins.rs:1588 — MacroCall::call has cognitive complexity 47 (threshold 15). Drivers by points: match/switch 9 (23 pts), if/else 10 (20 pts), loops 1 (4 pts) (nesting depth added 27). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · naga_cli · ×1
  • naga_cli::bin::naga::run (cognitive 44) naga-cli/src/bin/naga.rs:484 — naga_cli::bin::naga::run has cognitive complexity 44 (threshold 15). Drivers by points: if/else 27 (36 pts), match/switch 5 (7 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.
D2 · Cognitive Complexity · player · ×1
  • player::bin::play::main (cognitive 41) player/src/bin/play.rs:4 — player::bin::play::main has cognitive complexity 41 (threshold 15). Drivers by points: if/else 11 (31 pts), match/switch 4 (6 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Entry · ×1
  • Entry::check (cognitive 40) wgpu-core/src/command/bind.rs:71 — Entry::check has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (28 pts), loops 2 (8 pts), match/switch 1 (4 pts) (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · CommandBufferMutable · ×1
  • CommandBufferMutable::validate_acceleration_structure_actions (cognitive 36) wgpu-core/src/command/ray_tracing.rs:484 — CommandBufferMutable::validate_acceleration_structure_actions has cognitive complexity 36 (threshold 15). Drivers by points: if/else 4 (16 pts), loops 5 (14 pts), match/switch 2 (6 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Inner · ×1
  • Inner::create (cognitive 36) wgpu-hal/src/gles/egl.rs:408 — Inner::create has cognitive complexity 36 (threshold 15). Drivers by points: if/else 20 (21 pts), match/switch 5 (10 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · TypeContext · ×1
  • TypeContext::fmt (cognitive 35) naga/src/back/msl/writer.rs:220 — TypeContext::fmt has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (22 pts), match/switch 7 (12 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.
D2 · Cognitive Complexity · DeviceShared · ×1
  • DeviceShared::make_render_pass (cognitive 31) wgpu-hal/src/vulkan/device.rs:76 — DeviceShared::make_render_pass has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (27 pts), loops 1 (2 pts), boolean chains 1, match/switch 1 (nesting depth added 16). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Error · ×1
  • Error::as_parse_error (cognitive 27) naga/src/front/wgsl/error.rs:678 — Error::as_parse_error has cognitive complexity 27 (threshold 15). Drivers by points: match/switch 8 (16 pts), if/else 7 (11 pts) (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · RenderBundle · ×1
  • RenderBundle::execute (cognitive 27) wgpu-core/src/command/bundle.rs:1512 — RenderBundle::execute has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (19 pts), match/switch 2 (5 pts), boolean chains 2, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Buffer · ×1
  • Buffer::try_map_async (cognitive 25) wgpu-core/src/resource.rs:823 — Buffer::try_map_async has cognitive complexity 25 (threshold 15). Drivers by points: if/else 17 (20 pts), match/switch 3 (4 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.
D2 · Cognitive Complexity · DescriptorAllocator · ×1
  • DescriptorAllocator::alloc (cognitive 25) wgpu-hal/src/vulkan/descriptor.rs:158 — DescriptorAllocator::alloc has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (12 pts), match/switch 3 (9 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.
D2 · Cognitive Complexity · deno_webgpu · ×1
  • deno_webgpu::get_data_slice (cognitive 22) deno_webgpu/lib.rs:378 — deno_webgpu::get_data_slice has cognitive complexity 22 (threshold 15). Drivers by points: if/else 17 (22 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.
D2 · Cognitive Complexity · TypedGlobalVariable · ×1
  • TypedGlobalVariable::to_parts (cognitive 22) naga/src/back/msl/writer.rs:414 — TypedGlobalVariable::to_parts has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 4 (8 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WebCommandEncoder · ×1
  • WebCommandEncoder::begin_render_pass (cognitive 22) wgpu/src/backend/webgpu.rs:3450 — WebCommandEncoder::begin_render_pass has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 4 (7 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CoreDevice · ×1
  • CoreDevice::create_bind_group (cognitive 22) wgpu/src/backend/wgpu_core.rs:1042 — CoreDevice::create_bind_group has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 3 (6 pts), match/switch 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.
D2 · Cognitive Complexity · Function · ×1
  • Function::to_words (cognitive 21) naga/src/back/spv/writer.rs:36 — Function::to_words has cognitive complexity 21 (threshold 15). Drivers by points: loops 8 (19 pts), if/else 1 (2 pts) (nesting depth added 12). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · RequestAdapterError · ×1
  • RequestAdapterError::fmt (cognitive 21) wgpu-types/src/adapter.rs:279 — RequestAdapterError::fmt has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (18 pts), loops 1 (2 pts), match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Options · ×1
  • Options::resolve_local_binding (cognitive 20) naga/src/back/msl/mod.rs:468 — Options::resolve_local_binding has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (13 pts), match/switch 3 (5 pts), boolean chains 2 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · VertexLimits · ×1
  • VertexLimits::new (cognitive 19) wgpu-core/src/command/render.rs:443 — VertexLimits::new has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (16 pts), match/switch 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.
D2 · Cognitive Complexity · InitTrackerDrain · ×1
  • InitTrackerDrain::next (cognitive 18) wgpu-core/src/init_tracker/mod.rs:111 — InitTrackerDrain::next has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (17 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.
D2 · Cognitive Complexity · PrivateCapabilities · ×1
  • PrivateCapabilities::map_texture_format (cognitive 18) wgpu-hal/src/vulkan/conv.rs:6 — PrivateCapabilities::map_texture_format has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), match/switch 5 (8 pts) (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ModuleTracer · ×1
  • ModuleTracer::type_expression_tandem (cognitive 17) naga/src/compact/mod.rs:473 — ModuleTracer::type_expression_tandem has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (7 pts), loops 4 (5 pts), match/switch 2 (5 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ShaderStagesBits · ×1
  • ShaderStagesBits::write_hex (cognitive 17) wgpu-types/src/binding.rs:196 — ShaderStagesBits::write_hex has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (7 pts), loops 2 (6 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.
D2 · Cognitive Complexity · BufferUsagesBits · ×1
  • BufferUsagesBits::write_hex (cognitive 17) wgpu-types/src/buffer.rs:47 — BufferUsagesBits::write_hex has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (7 pts), loops 2 (6 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.
D2 · Cognitive Complexity · FeatureBits · ×1
  • FeatureBits::write_hex (cognitive 17) wgpu-types/src/features.rs:213 — FeatureBits::write_hex has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (7 pts), loops 2 (6 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.
D2 · Cognitive Complexity · Player · ×1
  • Player::process (cognitive 16) player/src/lib.rs:100 — Player::process has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 pts), match/switch 1 (nesting depth added 5). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · BindGroupLayoutEntry · ×1
  • BindGroupLayoutEntry::try_into (cognitive 16) wgpu-core/src/binding_model.rs:1046 — BindGroupLayoutEntry::try_into has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (16 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.
D2 · Cognitive Complexity · InitTracker · ×1
  • InitTracker::discard (cognitive 16) wgpu-core/src/init_tracker/mod.rs:261 — InitTracker::discard 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.
D2 · Cognitive Complexity · CompilationContext · ×1
  • CompilationContext::consume_reflection (cognitive 16) wgpu-hal/src/gles/device.rs:37 — CompilationContext::consume_reflection has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 4 (8 pts), if/else 3 (5 pts), loops 3 (nesting depth added 6). 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.
D35 · Change Coupling · Change coupling clique · ×1
  • Change coupling clique: dispatch.rs, draw.rs, mod.rs wgpu-core/src/indirect_validation/dispatch.rs — 3 files — `wgpu-core/src/indirect_validation/dispatch.rs`, `wgpu-core/src/indirect_validation/draw.rs`, `wgpu-core/src/timestamp_normalization/mod.rs` — all change together with no explicit dependency: a fully-connected co-change clique, not 3 separate couplings. They share one concern (thin parallel siblings over a common abstraction), so extract the shared part into ONE unit and the whole clique's coupling clears at once — you do not need to break each pair individually.
D4 · Code Duplication · Edited copy of a member (15 corresponding lines) · ×1
  • Edited copy of a member (15 corresponding lines) naga/src/front/wgsl/error.rs:91 — naga/src/front/wgsl/error.rs:91-107 | naga/src/span.rs:288-305 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (6 members, 50+ identical tokens) naga/src/back/dot/mod.rs:65 — naga/src/back/dot/mod.rs:65-447 | naga/src/back/glsl/writer.rs:1610-2289 | naga/src/back/msl/writer.rs:3920-4497 | naga/src/back/wgsl/writer.rs:752-1259 | naga/src/valid/analyzer.rs:886-1234 | naga/src/valid/function.rs:730-786 — 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) naga/src/front/spv/mod.rs:2160 — naga/src/front/spv/mod.rs:2160-2189 | naga/src/front/spv/mod.rs:2258-2291 | naga/src/front/spv/mod.rs:2313-2377 | naga/src/front/spv/mod.rs:2383-2464 | naga/src/front/spv/mod.rs:2627-2717 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication · Duplicated block (73–74 lines × 2) · ×1
  • Duplicated block (73–74 lines × 2) naga/src/front/glsl/context.rs:840 — naga/src/front/glsl/context.rs:840-912 | naga/src/front/glsl/context.rs:920-993 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (44 lines × 3) · ×1
  • Duplicated block (44 lines × 3) wgpu-core/src/device/resource.rs:5170 — wgpu-core/src/device/resource.rs:5170-5213 | wgpu-core/src/device/resource.rs:5222-5265 | wgpu-core/src/device/resource.rs:5272-5315 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (44 lines × 2) · ×1
  • Duplicated block (44 lines × 2) naga/src/back/glsl/writer.rs:2174 — naga/src/back/glsl/writer.rs:2174-2217 | naga/src/back/wgsl/writer.rs:1113-1156 — `naga/src/back/glsl/writer.rs` and `naga/src/back/wgsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 135 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (40 lines × 2) · ×1
  • Duplicated block (40 lines × 2) naga/src/front/spv/next_block.rs:1116 — naga/src/front/spv/next_block.rs:1116-1155 | naga/src/front/spv/next_block.rs:1184-1223 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (37 lines × 2) · ×1
  • Duplicated block (37 lines × 2) naga/src/back/spv/block.rs:1840 — naga/src/back/spv/block.rs:1840-1876 | naga/src/back/spv/block.rs:1890-1926 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (36 lines × 2) · ×1
  • Duplicated block (36 lines × 2) wgpu-types/src/texture/format.rs:1355 — wgpu-types/src/texture/format.rs:1355-1390 | wgpu-types/src/texture/format.rs:1439-1474 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (33–34 lines × 3) · ×1
  • Duplicated block (33–34 lines × 3) deno_webgpu/compute_pass.rs:127 — deno_webgpu/compute_pass.rs:127-159 | deno_webgpu/render_bundle.rs:121-153 | deno_webgpu/render_pass.rs:182-215 — before extracting anything, compare `deno_webgpu/compute_pass.rs` and `deno_webgpu/render_pass.rs` 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.
D4 · Code Duplication · Duplicated block (33–34 lines × 2) · ×1
  • Duplicated block (33–34 lines × 2) naga/src/front/glsl/builtins.rs:974 — naga/src/front/glsl/builtins.rs:974-1007 | naga/src/front/glsl/builtins.rs:1130-1162 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (32 lines × 2) · ×1
  • Duplicated block (32 lines × 2) wgpu-core/src/device/queue.rs:1191 — wgpu-core/src/device/queue.rs:1191-1222 | wgpu-core/src/device/queue.rs:1477-1508 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (28 lines × 2) · ×1
  • Duplicated block (28 lines × 2) naga/src/front/spv/next_block.rs:935 — naga/src/front/spv/next_block.rs:935-962 | naga/src/front/spv/next_block.rs:1010-1037 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (26–27 lines × 2) · ×1
  • Duplicated block (26–27 lines × 2) wgpu-hal/src/gles/egl.rs:1405 — wgpu-hal/src/gles/egl.rs:1405-1430 | wgpu-hal/src/gles/wgl.rs:798-824 — before extracting anything, compare `wgpu-hal/src/gles/egl.rs` and `wgpu-hal/src/gles/wgl.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 73 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (18–26 lines × 2) · ×1
  • Duplicated block (18–26 lines × 2) naga/src/back/hlsl/writer.rs:3773 — naga/src/back/hlsl/writer.rs:3773-3790 | naga/src/back/wgsl/writer.rs:1513-1538 — `naga/src/back/hlsl/writer.rs` and `naga/src/back/wgsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 18 separate duplicated blocks between them, totalling at least 185 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (23–25 lines × 2) · ×1
  • Duplicated block (23–25 lines × 2) wgpu-core/src/command/query.rs:331 — wgpu-core/src/command/query.rs:331-353 | wgpu-core/src/command/query.rs:387-411 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (21–24 lines × 2) · ×1
  • Duplicated block (21–24 lines × 2) naga/src/back/msl/writer.rs:6005 — naga/src/back/msl/writer.rs:6005-6028 | naga/src/back/msl/writer.rs:6095-6115 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (22–23 lines × 3) · ×1
  • Duplicated block (22–23 lines × 3) naga/src/front/glsl/context.rs:668 — naga/src/front/glsl/context.rs:668-689 | naga/src/front/glsl/context.rs:874-896 | naga/src/front/glsl/context.rs:955-977 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (23 lines × 3) · ×1
  • Duplicated block (23 lines × 3) naga/src/front/spv/mod.rs:1087 — naga/src/front/spv/mod.rs:1087-1109 | naga/src/front/spv/mod.rs:1165-1187 | naga/src/front/spv/mod.rs:1240-1262 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (20–22 lines × 2) · ×1
  • Duplicated block (20–22 lines × 2) naga/src/back/spv/writer.rs:1397 — naga/src/back/spv/writer.rs:1397-1416 | naga/src/back/spv/writer.rs:1429-1450 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (19–21 lines × 4) · ×1
  • Duplicated block (19–21 lines × 4) wgpu-core/src/device/resource.rs:5191 — wgpu-core/src/device/resource.rs:5191-5209 | wgpu-core/src/device/resource.rs:5243-5261 | wgpu-core/src/device/resource.rs:5293-5311 | wgpu-core/src/device/resource.rs:5351-5371 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (15–21 lines × 2) · ×1
  • Duplicated block (15–21 lines × 2) naga/src/back/msl/writer.rs:5989 — naga/src/back/msl/writer.rs:5989-6003 | naga/src/back/msl/writer.rs:6073-6093 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (18–20 lines × 3) · ×1
  • Duplicated block (18–20 lines × 3) naga/src/back/spv/block.rs:1859 — naga/src/back/spv/block.rs:1859-1876 | naga/src/back/spv/block.rs:1909-1926 | naga/src/back/spv/image.rs:436-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.
D4 · Code Duplication · Duplicated block (18–19 lines × 2) · ×1
  • Duplicated block (18–19 lines × 2) wgpu-core/src/command/transfer.rs:1299 — wgpu-core/src/command/transfer.rs:1299-1317 | wgpu-core/src/command/transfer.rs:1422-1439 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (18 lines × 3) · ×1
  • Duplicated block (18 lines × 3) naga/src/front/spv/next_block.rs:2675 — naga/src/front/spv/next_block.rs:2675-2692 | naga/src/front/spv/next_block.rs:2756-2773 | naga/src/front/spv/next_block.rs:2811-2828 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (15–18 lines × 2) · ×1
  • Duplicated block (15–18 lines × 2) naga/src/back/glsl/writer.rs:2783 — naga/src/back/glsl/writer.rs:2783-2797 | naga/src/back/glsl/writer.rs:4311-4328 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (16–18 lines × 2) · ×1
  • Duplicated block (16–18 lines × 2) naga/src/back/spv/image.rs:881 — naga/src/back/spv/image.rs:881-898 | naga/src/back/spv/image.rs:901-916 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (16–17 lines × 2) · ×1
  • Duplicated block (16–17 lines × 2) wgpu-core/src/device/resource.rs:918 — wgpu-core/src/device/resource.rs:918-933 | wgpu-core/src/device/resource.rs:939-955 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (16 lines × 3) · ×1
  • Duplicated block (16 lines × 3) wgpu/src/backend/webgpu.rs:3708 — wgpu/src/backend/webgpu.rs:3708-3723 | wgpu/src/backend/webgpu.rs:3804-3819 | wgpu/src/backend/webgpu.rs:4091-4106 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (14–15 lines × 3) · ×1
  • Duplicated block (14–15 lines × 3) naga/src/back/hlsl/help.rs:1400 — naga/src/back/hlsl/help.rs:1400-1414 | naga/src/back/hlsl/help.rs:1442-1456 | naga/src/back/hlsl/help.rs:1511-1524 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (15 lines × 3) · ×1
  • Duplicated block (15 lines × 3) naga/src/front/spv/mod.rs:2140 — naga/src/front/spv/mod.rs:2140-2154 | naga/src/front/spv/mod.rs:2175-2189 | naga/src/front/spv/mod.rs:2202-2216 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (13–15 lines × 2) · ×1
  • Duplicated block (13–15 lines × 2) wgpu-core/src/indirect_validation/dispatch.rs:196 — wgpu-core/src/indirect_validation/dispatch.rs:196-208 | wgpu-core/src/indirect_validation/draw.rs:130-144 — before extracting anything, compare `wgpu-core/src/indirect_validation/dispatch.rs` and `wgpu-core/src/indirect_validation/draw.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 83 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (11–14 lines × 5) · ×1
  • Duplicated block (11–14 lines × 5) wgpu-core/src/device/resource.rs:4589 — wgpu-core/src/device/resource.rs:4589-4599 | wgpu-core/src/device/resource.rs:5190-5201 | wgpu-core/src/device/resource.rs:5242-5253 | wgpu-core/src/device/resource.rs:5292-5303 | wgpu-core/src/device/resource.rs:5349-5362 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (13–14 lines × 4) · ×1
  • Duplicated block (13–14 lines × 4) wgpu-core/src/device/resource.rs:5177 — wgpu-core/src/device/resource.rs:5177-5189 | wgpu-core/src/device/resource.rs:5229-5241 | wgpu-core/src/device/resource.rs:5279-5291 | wgpu-core/src/device/resource.rs:5334-5347 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (14 lines × 3) · ×1
  • Duplicated block (14 lines × 3) naga/src/front/wgsl/lower/mod.rs:3812 — naga/src/front/wgsl/lower/mod.rs:3812-3825 | naga/src/front/wgsl/lower/mod.rs:3835-3848 | naga/src/front/wgsl/lower/mod.rs:3858-3871 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (13–14 lines × 2) · ×1
  • Duplicated block (13–14 lines × 2) wgpu-core/src/command/mod.rs:1126 — wgpu-core/src/command/mod.rs:1126-1139 | wgpu-core/src/command/mod.rs:1218-1230 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (11–13 lines × 3) · ×1
  • Duplicated block (11–13 lines × 3) naga/src/front/wgsl/parse/number.rs:188 — naga/src/front/wgsl/parse/number.rs:188-198 | naga/src/front/wgsl/parse/number.rs:217-229 | naga/src/front/wgsl/parse/number.rs:275-285 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (12–13 lines × 3) · ×1
  • Duplicated block (12–13 lines × 3) wgpu-core/src/command/render.rs:4217 — wgpu-core/src/command/render.rs:4217-4228 | wgpu-core/src/command/render.rs:4266-4278 | wgpu-core/src/command/render.rs:4319-4331 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (12–13 lines × 2) · ×1
  • Duplicated block (12–13 lines × 2) naga/src/back/spv/index.rs:375 — naga/src/back/spv/index.rs:375-387 | naga/src/back/spv/index.rs:439-450 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (11–12 lines × 2) · ×1
  • Duplicated block (11–12 lines × 2) naga/src/front/spv/mod.rs:2877 — naga/src/front/spv/mod.rs:2877-2888 | naga/src/front/spv/mod.rs:2900-2910 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (11 lines × 6) · ×1
  • Duplicated block (11 lines × 6) wgpu-hal/src/gles/queue.rs:499 — wgpu-hal/src/gles/queue.rs:499-509 | wgpu-hal/src/gles/queue.rs:514-524 | wgpu-hal/src/gles/queue.rs:529-539 | wgpu-hal/src/gles/queue.rs:541-553 | wgpu-hal/src/gles/queue.rs:559-569 | wgpu-hal/src/gles/queue.rs:574-584 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (11 lines × 4) · ×1
  • Duplicated block (11 lines × 4) wgpu-hal/src/gles/queue.rs:627 — wgpu-hal/src/gles/queue.rs:627-637 | wgpu-hal/src/gles/queue.rs:640-650 | wgpu-hal/src/gles/queue.rs:653-663 | wgpu-hal/src/gles/queue.rs:679-689 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (9–11 lines × 3) · ×1
  • Duplicated block (9–11 lines × 3) naga/src/back/hlsl/writer.rs:3465 — naga/src/back/hlsl/writer.rs:3465-3473 | naga/src/back/wgsl/writer.rs:1627-1637 | naga/src/back/wgsl/writer.rs:1701-1711 — `naga/src/back/hlsl/writer.rs` and `naga/src/back/wgsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 18 separate duplicated blocks between them, totalling at least 185 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (10–11 lines × 3) · ×1
  • Duplicated block (10–11 lines × 3) naga/src/front/glsl/parser.rs:273 — naga/src/front/glsl/parser.rs:273-282 | naga/src/front/glsl/parser.rs:351-360 | naga/src/front/glsl/parser.rs:380-390 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (8–11 lines × 3) · ×1
  • Duplicated block (8–11 lines × 3) naga/src/front/spv/next_block.rs:964 — naga/src/front/spv/next_block.rs:964-974 | naga/src/front/spv/next_block.rs:1098-1106 | naga/src/front/spv/next_block.rs:2963-2970 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (10–11 lines × 2) · ×1
  • Duplicated block (10–11 lines × 2) naga/src/back/spv/mesh_shader.rs:447 — naga/src/back/spv/mesh_shader.rs:447-457 | naga/src/back/spv/mesh_shader.rs:470-479 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (8–11 lines × 2) · ×1
  • Duplicated block (8–11 lines × 2) wgpu/src/backend/wgpu_core.rs:2059 — wgpu/src/backend/wgpu_core.rs:2059-2069 | wgpu/src/backend/wgpu_core.rs:2111-2118 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (6–10 lines × 10) · ×1
  • Duplicated block (6–10 lines × 10) naga/src/front/spv/next_block.rs:462 — naga/src/front/spv/next_block.rs:462-468 | naga/src/front/spv/next_block.rs:539-545 | naga/src/front/spv/next_block.rs:1073-1078 | naga/src/front/spv/next_block.rs:1105-1110 | naga/src/front/spv/next_block.rs:1175-1180 | naga/src/front/spv/next_block.rs:1270-1275 | naga/src/front/spv/next_block.rs:1484-1490 | naga/src/front/spv/next_block.rs:2364-2373 | naga/src/front/spv/next_block.rs:2715-2721 | naga/src/front/spv/next_block.rs:2786-2792 — all 10 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (10 lines × 4) · ×1
  • Duplicated block (10 lines × 4) naga/src/front/spv/mod.rs:2140 — naga/src/front/spv/mod.rs:2140-2149 | naga/src/front/spv/mod.rs:2175-2184 | naga/src/front/spv/mod.rs:2202-2211 | naga/src/front/spv/mod.rs:2238-2247 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (8–10 lines × 3) · ×1
  • Duplicated block (8–10 lines × 3) naga/src/back/glsl/writer.rs:847 — naga/src/back/glsl/writer.rs:847-854 | naga/src/back/hlsl/writer.rs:233-240 | naga/src/back/msl/writer.rs:3698-3707 — `naga/src/back/glsl/writer.rs` and `naga/src/back/hlsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 86 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (4–10 lines × 4) · ×1
  • Duplicated block (4–10 lines × 4) naga/src/front/spv/next_block.rs:2541 — naga/src/front/spv/next_block.rs:2541-2544 | naga/src/front/spv/next_block.rs:2636-2645 | naga/src/front/spv/next_block.rs:2723-2726 | naga/src/front/spv/next_block.rs:2789-2798 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (7–9 lines × 3) · ×1
  • Duplicated block (7–9 lines × 3) naga/src/back/hlsl/help.rs:1066 — naga/src/back/hlsl/help.rs:1066-1072 | naga/src/back/hlsl/help.rs:1140-1148 | naga/src/back/hlsl/help.rs:1217-1225 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (8–9 lines × 3) · ×1
  • Duplicated block (8–9 lines × 3) naga/src/front/spv/mod.rs:1128 — naga/src/front/spv/mod.rs:1128-1135 | naga/src/front/spv/mod.rs:1203-1210 | naga/src/front/spv/mod.rs:1273-1281 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (7–9 lines × 2) · ×1
  • Duplicated block (7–9 lines × 2) naga/src/front/spv/mod.rs:1479 — naga/src/front/spv/mod.rs:1479-1485 | naga/src/front/spv/next_block.rs:2902-2910 — before extracting anything, compare `naga/src/front/spv/mod.rs` and `naga/src/front/spv/next_block.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (6–9 lines × 3) · ×1
  • Duplicated block (6–9 lines × 3) naga/src/front/wgsl/lower/mod.rs:3689 — naga/src/front/wgsl/lower/mod.rs:3689-3697 | naga/src/front/wgsl/lower/mod.rs:3704-3712 | naga/src/front/wgsl/lower/mod.rs:3718-3723 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (7–8 lines × 5) · ×1
  • Duplicated block (7–8 lines × 5) naga/src/back/wgsl/writer.rs:916 — naga/src/back/wgsl/writer.rs:916-922 | naga/src/back/wgsl/writer.rs:945-951 | naga/src/back/wgsl/writer.rs:1625-1632 | naga/src/back/wgsl/writer.rs:1699-1706 | naga/src/back/wgsl/writer.rs:1747-1753 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (7–8 lines × 4) · ×1
  • Duplicated block (7–8 lines × 4) naga/src/front/spv/mod.rs:1070 — naga/src/front/spv/mod.rs:1070-1076 | naga/src/front/spv/mod.rs:1130-1136 | naga/src/front/spv/mod.rs:1205-1211 | naga/src/front/spv/mod.rs:1275-1282 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (4–8 lines × 3) · ×1
  • Duplicated block (4–8 lines × 3) naga/src/back/glsl/writer.rs:2149 — naga/src/back/glsl/writer.rs:2149-2152 | naga/src/back/glsl/writer.rs:2165-2172 | naga/src/back/glsl/writer.rs:2222-2229 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (7 lines × 6) · ×1
  • Duplicated block (7 lines × 6) naga/src/back/dot/mod.rs:379 — naga/src/back/dot/mod.rs:379-385 | naga/src/back/glsl/writer.rs:2269-2275 | naga/src/back/msl/writer.rs:4414-4420 | naga/src/back/wgsl/writer.rs:1206-1212 | naga/src/valid/analyzer.rs:1174-1180 | naga/src/valid/function.rs:732-738 — `naga/src/back/glsl/writer.rs` and `naga/src/back/msl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 66 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (7 lines × 4) · ×1
  • Duplicated block (7 lines × 4) naga/src/front/spv/next_block.rs:1047 — naga/src/front/spv/next_block.rs:1047-1053 | naga/src/front/spv/next_block.rs:1240-1246 | naga/src/front/spv/next_block.rs:1883-1889 | naga/src/front/spv/next_block.rs:2517-2523 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (6–7 lines × 2) · ×1
  • Duplicated block (6–7 lines × 2) naga/src/back/hlsl/help.rs:331 — naga/src/back/hlsl/help.rs:331-336 | naga/src/back/hlsl/help.rs:426-432 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (4–6 lines × 3) · ×1
  • Duplicated block (4–6 lines × 3) naga/src/front/glsl/builtins.rs:925 — naga/src/front/glsl/builtins.rs:925-928 | naga/src/front/glsl/builtins.rs:1079-1084 | naga/src/front/glsl/builtins.rs:1357-1362 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (5 lines × 12) · ×1
  • Duplicated block (5 lines × 12) naga/src/front/spv/next_block.rs:463 — naga/src/front/spv/next_block.rs:463-468 | naga/src/front/spv/next_block.rs:540-545 | naga/src/front/spv/next_block.rs:1049-1053 | naga/src/front/spv/next_block.rs:1074-1078 | naga/src/front/spv/next_block.rs:1106-1110 | naga/src/front/spv/next_block.rs:1176-1180 | naga/src/front/spv/next_block.rs:1242-1246 | naga/src/front/spv/next_block.rs:1271-1275 | naga/src/front/spv/next_block.rs:1485-1490 | naga/src/front/spv/next_block.rs:1884-1889 | naga/src/front/spv/next_block.rs:2365-2373 | naga/src/front/spv/next_block.rs:2716-2721 — all 12 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (5 lines × 6) · ×1
  • Duplicated block (5 lines × 6) naga/src/back/hlsl/writer.rs:2528 — naga/src/back/hlsl/writer.rs:2528-2533 | naga/src/back/wgsl/writer.rs:916-920 | naga/src/back/wgsl/writer.rs:945-949 | naga/src/back/wgsl/writer.rs:1625-1630 | naga/src/back/wgsl/writer.rs:1699-1704 | naga/src/back/wgsl/writer.rs:1747-1751 — `naga/src/back/hlsl/writer.rs` and `naga/src/back/wgsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 18 separate duplicated blocks between them, totalling at least 185 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (6 lines × 8) · ×1
  • Duplicated block (6 lines × 8) wgpu-core/src/command/bundle.rs:1407 — wgpu-core/src/command/bundle.rs:1407-1412 | wgpu-core/src/command/clear.rs:86-91 | wgpu-core/src/command/compute.rs:210-215 | wgpu-core/src/command/mod.rs:1665-1670 | wgpu-core/src/command/render.rs:1006-1011 | wgpu-core/src/device/queue.rs:693-698 | wgpu-core/src/device/queue.rs:731-736 | wgpu-core/src/resource.rs:2871-2876 — before extracting anything, compare `wgpu-core/src/command/bundle.rs` and `wgpu-core/src/command/render.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 83 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (12 lines × 4) · ×1
  • Duplicated block (12 lines × 4) wgpu-core/src/command/compute.rs:1399 — wgpu-core/src/command/compute.rs:1399-1411 | wgpu-core/src/command/compute.rs:1424-1437 | wgpu-core/src/command/render.rs:4422-4433 | wgpu-core/src/command/render.rs:4479-4491 — before extracting anything, compare `wgpu-core/src/command/compute.rs` and `wgpu-core/src/command/render.rs` as WHOLE FILES: this scan already matched 6 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.
D4 · Code Duplication · Duplicated block (11 lines × 8) · ×1
  • Duplicated block (11 lines × 8) naga/src/back/msl/writer.rs:5176 — naga/src/back/msl/writer.rs:5176-5188 | naga/src/back/msl/writer.rs:5223-5235 | naga/src/back/msl/writer.rs:5394-5406 | naga/src/back/msl/writer.rs:5450-5460 | naga/src/back/msl/writer.rs:5505-5517 | naga/src/back/msl/writer.rs:5603-5615 | naga/src/back/msl/writer.rs:5819-5839 | naga/src/back/msl/writer.rs:5847-5862 — all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (11 lines × 3) · ×1
  • Duplicated block (11 lines × 3) naga/src/back/msl/writer.rs:5111 — naga/src/back/msl/writer.rs:5111-5121 | naga/src/back/msl/writer.rs:5315-5325 | naga/src/back/msl/writer.rs:5742-5752 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (10 lines × 6) · ×1
  • Duplicated block (10 lines × 6) naga/src/back/msl/writer.rs:5158 — naga/src/back/msl/writer.rs:5158-5168 | naga/src/back/msl/writer.rs:5205-5215 | naga/src/back/msl/writer.rs:5372-5382 | naga/src/back/msl/writer.rs:5429-5438 | naga/src/back/msl/writer.rs:5483-5493 | naga/src/back/msl/writer.rs:5546-5556 — 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.
D44 · Platform End-of-Life · End-of-life runtime · ×1
  • End-of-life runtime: Rust 1.96 rust-toolchain.toml:1 — rust-toolchain.toml declares Rust 1.96 as this project's toolchain file, and Rust 1.96, superseded by 1.97 on 2026-07-09 (the Rust project patches only the current stable). An unsupported runtime receives no security patches, so every vulnerability disclosed in it since 2026-07-09 is present and unfixable without moving off it. This is a migration rather than an upgrade: there is no newer release of a runtime that has ended.
P12 · CI test-gate honesty · Coverage collected but not gated · ×1
  • Coverage collected but not gated — CI collects a coverage report but no step enforces a minimum — coverage could halve and CI stays green. Add a step that fails the build when coverage drops below a floor (your coverage tool's minimum-threshold flag, or a coverage-gate action) so the number guards something. What was searched, so you can tell an absence from a miss: this repository's CI files AND its coverage configuration — the well-known coverage and test-runner config files, read at the repository root and inside workspace package directories two levels down, so a floor declared beside the tests rather than in the pipeline is credited — matched against the threshold settings this check knows by name. A floor set in your coverage service's web UI rather than in a committed file, or under a setting whose name is not one of those, is not seen here.
Minor — 44 finding(s)
D34 · Knowledge Freshness · Orphaned file · ×19
  • Orphaned file naga/src/front/glsl/parser/types.rs: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 naga/src/back/continue_forward.rs: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 naga/src/front/glsl/ast.rs: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 naga/src/front/glsl/lex.rs: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 wgpu-hal/src/dx12/descriptor.rs: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 naga/src/front/atomic_upgrade.rs: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 naga/src/front/spv/convert.rs: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 naga/src/back/spv/subgroup.rs: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 naga/src/front/wgsl/index.rs: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 wgpu/src/util/encoder.rs: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 naga/src/front/glsl/mod.rs: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 naga/src/front/glsl/offset.rs: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 wgpu/src/util/device.rs: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 xtask/src/test_wasm.rs: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 naga/src/valid/compose.rs: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 naga/src/back/msl/sampler.rs: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 naga/src/ir/block.rs: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 naga/src/back/spv/f16_polyfill.rs: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 wgpu-hal/src/dynamic/adapter.rs: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.
X10 · Duplicated predicate · Duplicated predicate · ×7
  • Duplicated predicate naga/src/back/glsl/writer.rs:1834 — `!continuing.is_empty() || break_if.is_some()` appears character-identically in 4 files — naga/src/back/glsl/writer.rs, naga/src/back/hlsl/writer.rs, naga/src/back/msl/writer.rs, naga/src/back/wgsl/writer.rs. 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 wgpu-hal/src/gles/device.rs:405 — `!version.is_embedded && (version.major, version.minor) >= (4, 3)` appears character-identically in 2 files — wgpu-hal/src/gles/device.rs, wgpu-hal/src/gles/queue.rs. 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 wgpu-hal/src/auxil/dxgi/exception.rs:89 — `cfg!(debug_assertions) && level == log::Level::Error` appears character-identically in 2 files — wgpu-hal/src/auxil/dxgi/exception.rs, wgpu-hal/src/vulkan/instance.rs. 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 naga/src/back/spv/writer.rs:3917 — `ep_index.is_some() && ep_index != Some(index)` appears character-identically in 2 files — naga/src/back/spv/writer.rs, naga/src/proc/mod.rs. 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 naga/src/front/glsl/context.rs:640 — `left_columns == right_columns && left_rows == right_rows` appears character-identically in 2 files — naga/src/front/glsl/context.rs, naga/src/proc/constant_evaluator.rs. 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 wgpu-core/src/track/mod.rs:335 — `self.any_exclusive() && self.bits().count_ones() != 1` appears character-identically in 2 files — wgpu-core/src/track/mod.rs, wgpu-core/src/track/texture.rs. 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 naga/src/back/msl/mesh_shader.rs:222 — `var.space != crate::AddressSpace::WorkGroup || fun_info[handle].is_empty()` appears character-identically in 2 files — naga/src/back/msl/mesh_shader.rs, naga/src/back/msl/writer.rs. 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.
M4 · Documentation accuracy · README/code drift · ×3
  • README/code drift wgpu-hal/README.md:74 — wgpu-hal/README.md links to `vulkan/struct.Api.html`, but `wgpu-hal/vulkan/struct.Api.html` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift wgpu-hal/README.md:75 — wgpu-hal/README.md links to `metal/struct.Api.html`, but `wgpu-hal/metal/struct.Api.html` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift wgpu-hal/README.md:102 — wgpu-hal/README.md links to `gles/index.html`, but `wgpu-hal/gles/index.html` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
X7 · Silent fallback defaults · Silent fallback default on Err · ×3
  • Silent fallback default on Err wgpu-hal/src/gles/device.rs:1688 — `destroy_render_pipeline` turns every `Err` into `false` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err wgpu-hal/src/gles/device.rs:1724 — `destroy_compute_pipeline` turns every `Err` into `false` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err wgpu-hal/src/dx12/adapter.rs:1415 — `get_adapter_pci_info` turns every `Err` into `String::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
D16 · Bus Factor · Off-boarding risk · ×1
  • Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 12 significant file(s) lose their only recent owner: wgpu-types/src/bitflags_array.rs, wgpu-core-remote/src/global/render_pass.rs, wgpu-core-remote-types/src/encoders.rs, wgpu-core-remote/src/global/command_encoder.rs, wgpu-core-remote/src/global/compute_pass.rs, wgpu-core-remote-types/src/lib.rs, wgpu-core-remote-types/src/binding_model.rs, wgpu-core-remote/src/global/instance.rs (+4 more). Pair on, review, or document these before any departure.
D16 · Bus Factor · Further sole-owners (lower concentration) · ×1
  • Further sole-owners (lower concentration) — 5 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 (20 single-owned of 372 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; 372 of the 458 production source files in this repository met that bar). They are anonymized user #2 (2 file(s)), anonymized user #3 (2 file(s)), anonymized user #4 (2 file(s)), anonymized user #5 (1 file(s)), anonymized user #6 (1 file(s)) — spread or document their files in the same way, at lower priority than the named off-boarding risks above. The files folded here: naga/src/back/msl/ray.rs, naga/src/back/spv/ray/mod.rs, naga/src/back/msl/mesh_shader.rs, wgpu-hal/src/dx12/pipeline_desc.rs, naga/src/common/wgsl/types.rs, naga/hlsl-snapshots/src/lib.rs, lock-analyzer/src/main.rs, naga/src/back/spv/layout.rs.
D20 · ADR Quality · No ADRs found · ×1
  • No ADRs found — No ADRs found. No recognised ADR directory (`docs/adr/`, `docs/decisions/`, `adr/`, `docs/rfcs/`, an `ADR0001/` folder, or their siblings) exists anywhere in this tree. What was searched, so you can tell an empty log from a search that missed one: every directory under the tree (build output, dependencies and VCS metadata excepted), for a document that is either any non-index page inside a recognised ADR directory, whatever its name and however deeply nested (`docs/adr/use-postgres.md`, `docs/adr/2024/0001-x.md`); or a file anywhere whose name is ADR-shaped (`0001-use-postgres.md`, `adr-012-caching.md`); or, when neither turned anything up, a document carrying the decision-record signature (an "Architecture Decision Record" heading, or Status / Context / Decision / Consequences as section headings). A decision log that clears none of these — unnumbered files outside any recognised directory, without those headings — is not seen by this check and this row is then wrong. If that is your case, say so rather than renaming anything; otherwise, consider recording architectural decisions in `docs/adr/`.
D26 · Project Cohesion · Projects may be oversized for their cohesion · ×1
  • Projects may be oversized for their cohesion — 5 of 24 project(s) overshoot their size bounds, lowering Project Cohesion to 5.8/10. The most over is `naga` (110929 LoC, 401 module-visible types across 26 directories). Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
D34 · Knowledge Freshness · Further orphaned files (smaller) · ×1
  • Further orphaned files (smaller) — 19 smaller file(s) also have no living knowledge — folded into the freshness score and metrics rather than raised one row each — most significant first: naga/src/front/glsl/parser/types.rs, naga/src/back/continue_forward.rs, naga/src/front/glsl/ast.rs, naga/src/front/glsl/lex.rs, wgpu-hal/src/dx12/descriptor.rs, naga/src/front/atomic_upgrade.rs, naga/src/front/spv/convert.rs, naga/src/back/spv/subgroup.rs (and 11 more) (23 orphaned of 372 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; 372 of the 458 production source files in this repository met that bar). Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
M2 · Architecture documentation · No ADRs · ×1
  • No ADRs — No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
P2 · Observability · Logging is not universal · ×1
  • Logging is not universal — Only 11/13 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `lock-analyzer`, `naga/fuzz`.
X9 · Subsumed condition operand · Subsumed condition operand · ×1
  • Subsumed condition operand wgpu-hal/src/gles/adapter.rs:515 — `extensions.contains("GL_OVR_multiview2")` can never decide this `||` — every value satisfying `extensions.contains("GL_OVR_multiview2")` also satisfies `extensions.contains("OVR_multiview2")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
Minor — 3 finding(s)
D12 · Dependency Hygiene · Outdated · ×3
  • Outdated: deno_error — `deno_error` is locked at 0.7.0 but 0.7.3 is the current stable release on crates.io, and it already satisfies the `"0.7.0"` requirement declared in deno_webgpu/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p deno_error` and commit the updated REDACTED.
  • Outdated: ordered-float — `ordered-float` is locked at 5.4.0 but 5.5.1 is the current stable release on crates.io, and it already satisfies the `">=3, <6.0"` requirement declared in wgpu-hal/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p ordered-float` and commit the updated REDACTED.
  • Outdated: smallvec — `smallvec` is locked at 1.16.3 but 1.16.4 is the current stable release on crates.io, and it already satisfies the `"1.14"` requirement declared in wgpu-core/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p smallvec` and commit the updated REDACTED.

Appendix B — Reproduction & audit trail

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

DimensionToolVersionCommandFindingsRaw output
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/watchdog-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-ffa854f26c2a4a50afbbdf20a3786431/history.json --exit-code 0 --source .0artifacts/raw/gitleaks-history.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-git --no-banner --config /opt/gitleaks-rules/watchdog-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-ffa854f26c2a4a50afbbdf20a3786431/tree.json --exit-code 0 --source .0artifacts/raw/gitleaks-tree.json
D29 · Static Analysis (SAST)semgrep—semgrep --config /opt/semgrep-rules/security-audit.yml --config /opt/semgrep-rules/owasp-top-ten.yml --config /opt/semgrep-rules/watchdog-sast.yml --json --quiet --timeout 10 --timeout-threshold 3 --metrics off --exclude *.arrow --exclude *.avro --exclude *.csv --exclude *.dat --exclude *.db --exclude *.feather --exclude *.geojson --exclude *.h5 --exclude *.hdf5 --exclude *.jsonl --exclude *.log --exclude *.ndjson --exclude *.npy --exclude *.npz --exclude *.orc --exclude *.parquet --exclude *.pickle --exclude *.pkl --exclude *.psv --exclude *.sqlite --exclude *.sqlite3 --exclude *.tfrecord --exclude *.tsv --exclude *.txt --exclude wgpu/src/backend/webgpu/webgpu_sys .21artifacts/raw/semgrep.json
D30 · Dependency Vulnerabilitiestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** . --skip-db-update9artifacts/raw/trivy-fs.json
D31 · IaC & Container Securitytrivy—trivy: not applicable — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.0—
D32 · Data Compliance (PII/GDPR)semgrep—semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that.0—
D40 · Network Egress Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.0—
D41 · Kernel & Syscall Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.0—
D42 · Runtime Threat Enforcementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.0—
D43 · Malicious Dependenciestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** . --skip-db-update0artifacts/raw/trivy-fs.json

Run 01a1767e-75b4-7405-9f37-681a813a3f8d · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.

Downloadable artifacts

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

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