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

gfx-rs/wgpu

Measured 14 November 2026, 06:43 UTC, at code version 8430d65

CAI score 65out 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: 273,188 lines of product code in 24 projects, tests not counted · Estimated rebuild effort: about 2.8 person-years · Weakest lens: Security and Compliance, 58

Findings by how serious they are

30 critical 2039 serious 52 minor

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

This survey was produced by

Assert small markCanine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
14 November 2026, 06:43 UTC

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

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

46of 46 dimensions measured by tools.
2100of 2121 findings point to an exact file and line, so you can open each one in the code. The other 21 concern the repository as a whole, such as missing documentation.
46dimensions across 6 lenses, read from 273,188 lines of product code in 24 projects.
Chapters

Executive summary

gfx-rs/wgpu falls short of our standard for production, in part because it has pipeline tools referenced by a changeable name. It scores 65 out of 100 and is rated Adequate, and 21 of its 30 critical findings are security problems in the build pipeline and in its automatic dependency updates.

Security and Compliance, at 58, is the weakest lens and counts most in the score. The best first step is recording design decisions, worth about 4 points. Fixing the 16 pipeline tools referenced by a changeable name would lift Security and Compliance itself, also worth about 4. Raising Security and Compliance to 70 would lift the score to about 70.

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 six 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 three parts of the code nobody has worked on for a long time need someone to learn and document them before anyone changes them.

The product code is 273,188 lines, about €410,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.
Security and Compliance 58 · counts for 46%Maturity 65 · counts for 25%Production Readiness 73 · counts for 14%Code Health 80 · counts for 8%Performance 86 · counts for 4%Architecture 93 · counts for 2%

If Security and Compliance rose from 58 to 70, the lowest score rated Strong, the score would rise from 65 to about 70.

Code composition: what the lines of code are
Product code 79%Tests 21%
New since the last survey: 652 findings

These 652 critical or serious findings weren't in the previous survey, on 26 October 2026. The first 100 are listed here, and the findings file in the download package lists them all.

  • Cyclomatic Complexity · FunctionTracer::trace_block_impl (cyclomatic 36) naga/src/compact/statements.rs
  • Cyclomatic Complexity · wgpu_hal::metal::icb_probe::supports_render_icb (cyclomatic 23) wgpu-hal/src/metal/icb_probe.rs
  • Cyclomatic Complexity · Instance::request_adapters (cyclomatic 20) wgpu-core/src/instance.rs
  • Cyclomatic Complexity · CommandBufferMutable::validate_acceleration_structure_actions (cyclomatic 19) wgpu-core/src/command/ray_tracing.rs
  • Cyclomatic Complexity · Device::create_ray_tracing_pipeline_inner (cyclomatic 19) wgpu-core/src/device/ray_tracing.rs
  • Cyclomatic Complexity · Lowerer::bitcast_operand (cyclomatic 18) naga/src/front/wgsl/lower/mod.rs
  • Cyclomatic Complexity · Writer::put_return_value (cyclomatic 17) naga/src/back/msl/writer.rs
  • Cyclomatic Complexity · Device::create_texture_view (cyclomatic 17) wgpu-hal/src/metal/device.rs
  • Cyclomatic Complexity · CommandEncoder::defer_multi_draw_via_icb (cyclomatic 16) wgpu-hal/src/metal/icb.rs
  • Cognitive Complexity · FunctionTracer::trace_block_impl (cognitive 54) naga/src/compact/statements.rs
  • Cognitive Complexity · Writer::write_compute_workgroup_init (cognitive 35) naga/src/back/hlsl/writer.rs
  • Cognitive Complexity · Writer::write_wrapped_bitcast_functions (cognitive 31) naga/src/back/hlsl/help.rs
  • Cognitive Complexity · Instance::request_adapters (cognitive 29) wgpu-core/src/instance.rs
  • Cognitive Complexity · Device::create_ray_tracing_pipeline_inner (cognitive 27) wgpu-core/src/device/ray_tracing.rs
  • Cognitive Complexity · wgpu_hal::metal::icb_probe::supports_render_icb (cognitive 23) wgpu-hal/src/metal/icb_probe.rs
  • Cognitive Complexity · CommandEncoder::defer_multi_draw_via_icb (cognitive 18) wgpu-hal/src/metal/icb.rs
  • Cognitive Complexity · CommandEncoder::encode_deferred_icb_generation (cognitive 18) wgpu-hal/src/metal/icb.rs
  • Cognitive Complexity · Device::create_texture (cognitive 17) wgpu-hal/src/metal/device.rs
  • Cognitive Complexity · Writer::write_entry_point (cognitive 16) naga/src/back/spv/writer.rs
  • God Classes · MethodTooLong: Writer.write_hit_object_get_intersection_function naga/src/back/spv/ray/hit_object.rs
  • God Classes · FunctionTooLong: wgpu_hal::metal::icb_probe::supports_render_icb wgpu-hal/src/metal/icb_probe.rs
  • God Classes · MethodTooLong: Writer.write_hit_object_record_from_query naga/src/back/spv/ray/hit_object.rs
  • God Classes · MethodTooLong: FunctionTracer.trace_block_impl naga/src/compact/statements.rs
  • God Classes · MethodTooLong: Device.create_ray_tracing_pipeline_inner wgpu-core/src/device/ray_tracing.rs
  • God Classes · FunctionTooLong: wgpu_core::command::ray_tracing_pass::encode_ray_tracing_pass wgpu-core/src/command/ray_tracing_pass.rs
  • God Classes · MethodTooLong: Lowerer.call_hit_object_builtin naga/src/front/wgsl/lower/mod.rs
  • God Classes · FileTooLong: command/ray_tracing_pass.rs wgpu-core/src/command/ray_tracing_pass.rs
  • God Classes · MethodTooLong: Device.create_bind_group_layout wgpu-hal/src/vulkan/device.rs
  • God Classes · FileTooLong: ray/hit_object.rs naga/src/back/spv/ray/hit_object.rs
  • God Classes · FileTooLong: metal/icb.rs wgpu-hal/src/metal/icb.rs
  • God Classes · MethodTooLong: CommandEncoder.defer_multi_draw_via_icb wgpu-hal/src/metal/icb.rs
  • God Classes · MethodTooLong: Player.resolve_command player/src/lib.rs
  • God Classes · MethodTooLong: Instance.request_adapters wgpu-core/src/instance.rs
  • Code Duplication · Near-duplicate member pair (108 shared lines) wgpu-core/src/command/compute.rs
  • Code Duplication · Members sharing a duplicated core (7 members, 50+ identical tokens) naga/src/back/dot/mod.rs
  • Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) naga/src/front/spv/mod.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) naga/src/back/hlsl/help.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) naga/src/front/spv/mod.rs
  • Code Duplication · Edited copy of a member (113 corresponding lines) wgpu-core/src/command/transfer.rs
  • Code Duplication · Edited copy of a member (79 corresponding lines) wgpu/src/backend/wgpu_core.rs
  • Code Duplication · Edited copies of one member (3 members, 66+ corresponding lines) deno_webgpu/compute_pass.rs
  • Code Duplication · Edited copy of a member (68 corresponding lines) wgpu-core/src/command/bundle.rs
  • Code Duplication · Edited copy of a member (62 corresponding lines) naga/src/front/glsl/functions.rs
  • Code Duplication · Edited copy of a member (81 corresponding lines) wgpu-core/src/command/compute.rs
  • Code Duplication · Edited copy of a member (67 corresponding lines) wgpu-core/src/resource.rs
  • Code Duplication · Edited copy of a member (54 corresponding lines) naga/src/front/spv/mod.rs
  • Code Duplication · Edited copy of a member (63 corresponding lines) wgpu-hal/src/dx12/view.rs
  • Code Duplication · Edited copies of one member (3 members, 55+ corresponding lines) deno_webgpu/webidl.rs
  • Code Duplication · Edited copies of one member (3 members, 44+ corresponding lines) naga/src/back/hlsl/help.rs
  • Code Duplication · Edited copies of one member (3 members, 1+ corresponding lines) wgpu-types/src/binding.rs
  • Code Duplication · Edited copy of a member (38 corresponding lines) naga/src/front/spv/image.rs
  • Code Duplication · Edited copy of a member (40 corresponding lines) wgpu-core/src/command/bundle.rs
  • Code Duplication · Edited copy of a member (36 corresponding lines) naga/src/front/spv/mod.rs
  • Code Duplication · Edited copy of a member (30 corresponding lines) naga/src/back/spv/writer.rs
  • Code Duplication · Edited copy of a member (27 corresponding lines) wgpu-core/src/device/resource.rs
  • Code Duplication · Edited copy of a member (46 corresponding lines) naga/src/back/hlsl/writer.rs
  • Code Duplication · Edited copy of a member (39 corresponding lines) wgpu-core/src/command/bundle.rs
  • Code Duplication · Edited copy of a member (35 corresponding lines) wgpu-hal/src/dx12/suballocation.rs
  • Code Duplication · Edited copy of a member (32 corresponding lines) naga/src/back/spv/index.rs
  • Code Duplication · Edited copy of a member (39 corresponding lines) naga/src/back/glsl/writer.rs
  • Code Duplication · Edited copies of one member (3 members, 32+ corresponding lines) wgpu-hal/src/dx12/suballocation.rs
  • Code Duplication · Edited copy of a member (30 corresponding lines) wgpu-hal/src/metal/command.rs
  • Code Duplication · Edited copy of a member (32 corresponding lines) wgpu-core/src/command/ray_tracing_pass.rs
  • Code Duplication · Edited copy of a member (30 corresponding lines) wgpu-core/src/indirect_validation/dispatch.rs
  • Code Duplication · Edited copy of a member (24 corresponding lines) wgpu-hal/src/auxil/dxgi/dxgi_lib.rs
  • Code Duplication · Edited copies of one member (3 members, 30+ corresponding lines) wgpu-core/src/command/transfer.rs
  • Code Duplication · Edited copy of a member (27 corresponding lines) wgpu-core/src/command/query.rs
  • Code Duplication · Edited copy of a member (24 corresponding lines) naga/src/back/spv/writer.rs
  • Code Duplication · Edited copy of a member (23 corresponding lines) naga/src/back/msl/writer.rs
  • Code Duplication · Edited copy of a member (14 corresponding lines) naga/src/back/glsl/writer.rs
  • Code Duplication · Edited copies of one member (3 members, 18+ corresponding lines) wgpu-core/src/binding_model.rs
  • Code Duplication · Edited copy of a member (21 corresponding lines) wgpu-hal/src/dx12/mod.rs
  • Code Duplication · Edited copies of one member (3 members, 28+ corresponding lines) wgpu-core/src/track/texture.rs
  • Code Duplication · Edited copies of one member (3 members, 48+ corresponding lines) naga/src/back/hlsl/mod.rs
  • Code Duplication · Edited copies of one member (3 members, 20+ corresponding lines) naga/src/front/spv/mod.rs
  • Code Duplication · Edited copy of a member (28 corresponding lines) deno_webgpu/device.rs
  • Code Duplication · Edited copies of one member (3 members, 33+ corresponding lines) wgpu-hal/src/dx12/command.rs
  • Code Duplication · Edited copies of one member (3 members, 17+ corresponding lines) wgpu-core/src/device/resource.rs
  • Code Duplication · Edited copies of one member (3 members, 18+ corresponding lines) naga/src/front/wgsl/lower/mod.rs
  • Code Duplication · Edited copy of a member (14 corresponding lines) wgpu-core/src/pipeline.rs
  • Code Duplication · Edited copies of one member (4 members, 20+ corresponding lines) wgpu-core/src/pipeline.rs
  • Code Duplication · Edited copy of a member (24 corresponding lines) wgpu-hal/src/dx12/command.rs
  • Code Duplication · Edited copy of a member (17 corresponding lines) naga/src/front/spv/mod.rs
  • Code Duplication · Edited copy of a member (25 corresponding lines) wgpu-core/src/command/mod.rs
  • Code Duplication · Edited copies of one member (3 members, 23+ corresponding lines) wgpu-hal/src/gles/egl.rs
  • Code Duplication · Edited copies of one member (3 members, 32+ corresponding lines) wgpu-core/src/command/compute.rs
  • Code Duplication · Edited copies of one member (3 members, 27+ corresponding lines) wgpu-core/src/track/buffer.rs
  • Code Duplication · Edited copies of one member (5 members, 21+ corresponding lines) wgpu-hal/src/vulkan/instance.rs
  • Code Duplication · Edited copy of a member (23 corresponding lines) wgpu-core/src/command/mod.rs
  • Code Duplication · Edited copy of a member (37 corresponding lines) naga/src/back/hlsl/help.rs
  • Code Duplication · Edited copy of a member (17 corresponding lines) wgpu-core/src/device/resource.rs
  • Code Duplication · Edited copies of one member (4 members, 18+ corresponding lines) wgpu-core/src/device/resource.rs
  • Code Duplication · Edited copy of a member (34 corresponding lines) wgpu-core/src/command/bundle.rs
  • Code Duplication · Edited copy of a member (23 corresponding lines) naga/src/back/glsl/writer.rs
  • Code Duplication · Edited copies of one member (3 members, 20+ corresponding lines) wgpu-core/src/pipeline.rs
  • Code Duplication · Edited copies of one member (3 members, 17+ corresponding lines) wgpu-hal/src/auxil/dxgi/dxgi_lib.rs
  • Code Duplication · Edited copy of a member (19 corresponding lines) wgpu-hal/src/dx12/suballocation.rs
  • Code Duplication · Edited copy of a member (21 corresponding lines) wgpu-core/src/command/compute.rs
  • Code Duplication · Edited copy of a member (17 corresponding lines) wgpu-hal/src/gles/device.rs
  • Code Duplication · Edited copy of a member (13 corresponding lines) wgpu-core/src/indirect_validation/draw.rs

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

Fixed since the last survey: 127 findings

These 127 critical or serious findings were in the previous survey, on 26 October 2026, and are gone from this one. The first 100 are listed here.

  • Cyclomatic Complexity · FunctionTracer::trace_block (cyclomatic 33) naga/src/compact/statements.rs
  • Cyclomatic Complexity · Instance::request_adapter (cyclomatic 21) wgpu-core/src/instance.rs
  • Cognitive Complexity · FunctionTracer::trace_block (cognitive 50) naga/src/compact/statements.rs
  • Cognitive Complexity · Instance::request_adapter (cognitive 31) wgpu-core/src/instance.rs
  • Cognitive Complexity · Device::create_texture_inner (cognitive 22) wgpu-core/src/device/resource.rs
  • God Classes · MethodTooLong: FunctionTracer.trace_block naga/src/compact/statements.rs
  • God Classes · MethodTooLong: Writer.write_global naga/src/back/hlsl/writer.rs
  • God Classes · MethodTooLong: Instance.request_adapter wgpu-core/src/instance.rs
  • God Classes · MethodTooLong: Device.create_shader_module_inner wgpu-core/src/device/resource.rs
  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) naga/src/back/dot/mod.rs
  • Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) naga/src/front/spv/mod.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) naga/src/back/hlsl/help.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) naga/src/front/spv/mod.rs
  • Code Duplication · Duplicated block (44 lines × 3) wgpu-core/src/device/resource.rs
  • Code Duplication · Duplicated block (36 lines × 2) wgpu-types/src/texture/format.rs
  • Code Duplication · Duplicated block (26–27 lines × 2) wgpu-hal/src/gles/egl.rs
  • Code Duplication · Duplicated block (26 lines × 2) naga/src/front/spv/image.rs
  • Code Duplication · Duplicated block (23 lines × 3) naga/src/front/spv/mod.rs
  • Code Duplication · Duplicated block (23 lines × 2) wgpu-core/src/device/queue.rs
  • Code Duplication · Duplicated block (19–21 lines × 4) wgpu-core/src/device/resource.rs
  • Code Duplication · Duplicated block (18 lines × 3) naga/src/front/spv/next_block.rs
  • Code Duplication · Duplicated block (17–18 lines × 2) naga/src/back/glsl/conv.rs
  • Code Duplication · Duplicated block (15–18 lines × 2) naga/src/back/glsl/writer.rs
  • Code Duplication · Duplicated block (18 lines × 2) naga/src/back/hlsl/writer.rs
  • Code Duplication · Duplicated block (18 lines × 2) naga/src/front/spv/next_block.rs
  • Code Duplication · Duplicated block (17–18 lines × 2) wgpu-core/src/command/ray_tracing.rs
  • Code Duplication · Duplicated block (17 lines × 2) naga/src/valid/interface.rs
  • Code Duplication · Duplicated block (16 lines × 2) naga/src/back/hlsl/help.rs
  • Code Duplication · Duplicated block (16 lines × 2) naga/src/back/spv/image.rs
  • Code Duplication · Duplicated block (12–16 lines × 2) naga/src/back/wgsl/writer.rs
  • Code Duplication · Duplicated block (16 lines × 2) naga/src/valid/interface.rs
  • Code Duplication · Duplicated block (15–16 lines × 2) wgpu-core/src/device/resource.rs
  • Code Duplication · Duplicated block (12–16 lines × 2) wgpu-core/src/device/resource.rs
  • Code Duplication · Duplicated block (16 lines × 2) wgpu-core/src/indirect_validation/dispatch.rs
  • Code Duplication · Duplicated block (16 lines × 2) wgpu-core/src/track/texture.rs
  • Code Duplication · Duplicated block (16 lines × 2) wgpu-hal/src/metal/conv.rs
  • Code Duplication · Duplicated block (14–15 lines × 3) naga/src/back/hlsl/help.rs
  • Code Duplication · Duplicated block (15 lines × 2) naga/src/back/glsl/writer.rs
  • Code Duplication · Duplicated block (15 lines × 2) naga/src/valid/expression.rs
  • Code Duplication · Duplicated block (15 lines × 2) naga/src/valid/interface.rs
  • Code Duplication · Duplicated block (13–15 lines × 2) wgpu-core/src/indirect_validation/dispatch.rs
  • Code Duplication · Duplicated block (11–14 lines × 5) wgpu-core/src/device/resource.rs
  • Code Duplication · Duplicated block (13–14 lines × 4) wgpu-core/src/device/resource.rs
  • Code Duplication · Duplicated block (14 lines × 3) naga/src/front/wgsl/lower/mod.rs
  • Code Duplication · Duplicated block (14 lines × 2) naga/src/front/wgsl/lower/construction.rs
  • Code Duplication · Duplicated block (14 lines × 2) wgpu-core/src/command/transfer.rs
  • Code Duplication · Duplicated block (13 lines × 3) naga/src/back/glsl/writer.rs
  • Code Duplication · Duplicated block (13 lines × 2) naga/src/back/hlsl/help.rs
  • Code Duplication · Duplicated block (13 lines × 2) naga/src/front/wgsl/lower/mod.rs
  • Code Duplication · Duplicated block (12 lines × 3) naga/src/valid/interface.rs
  • Code Duplication · Duplicated block (12 lines × 2) naga/src/back/glsl/writer.rs
  • Code Duplication · Duplicated block (12 lines × 2) naga/src/front/glsl/functions.rs
  • Code Duplication · Duplicated block (11–12 lines × 2) naga/src/front/spv/mod.rs
  • Code Duplication · Duplicated block (12 lines × 2) wgpu-hal/src/metal/command.rs
  • Code Duplication · Duplicated block (11 lines × 4) wgpu-hal/src/gles/queue.rs
  • Code Duplication · Duplicated block (11 lines × 2) naga/src/valid/function.rs
  • Code Duplication · Duplicated block (11 lines × 2) naga/src/valid/interface.rs
  • Code Duplication · Duplicated block (11 lines × 2) wgpu-hal/src/gles/queue.rs
  • Code Duplication · Duplicated block (11 lines × 2) wgpu/src/backend/wgpu_core.rs
  • Code Duplication · Duplicated block (8–11 lines × 2) wgpu/src/backend/wgpu_core.rs
  • Code Duplication · Duplicated block (6–10 lines × 10) naga/src/front/spv/next_block.rs
  • Code Duplication · Duplicated block (4–10 lines × 4) naga/src/front/spv/next_block.rs
  • Code Duplication · Duplicated block (10 lines × 2) naga/src/proc/constant_evaluator.rs
  • Code Duplication · Duplicated block (10 lines × 2) wgpu-info/src/human.rs
  • Code Duplication · Duplicated block (10 lines × 2) wgpu/src/backend/wgpu_core.rs
  • Code Duplication · Duplicated block (8–9 lines × 3) naga/src/front/spv/mod.rs
  • Code Duplication · Duplicated block (9 lines × 2) naga/src/back/hlsl/writer.rs
  • Code Duplication · Duplicated block (7–9 lines × 2) naga/src/front/spv/mod.rs
  • Code Duplication · Duplicated block (6–9 lines × 3) naga/src/front/wgsl/lower/mod.rs
  • Code Duplication · Duplicated block (7–8 lines × 4) naga/src/front/spv/mod.rs
  • Code Duplication · Duplicated block (8 lines × 3) wgpu-hal/src/gles/egl.rs
  • Code Duplication · Duplicated block (8 lines × 3) wgpu-hal/src/metal/command.rs
  • Code Duplication · Duplicated block (8 lines × 2) naga/src/back/msl/writer.rs
  • Code Duplication · Duplicated block (8 lines × 2) naga/src/front/spv/mod.rs
  • Code Duplication · Duplicated block (8 lines × 2) naga/src/front/wgsl/error.rs
  • Code Duplication · Duplicated block (8 lines × 2) naga/src/front/wgsl/lower/mod.rs
  • Code Duplication · Duplicated block (8 lines × 2) naga/src/proc/constant_evaluator.rs
  • Code Duplication · Duplicated block (8 lines × 2) naga/src/proc/constant_evaluator.rs
  • Code Duplication · Duplicated block (7 lines × 2) deno_webgpu/lib.rs
  • Code Duplication · Duplicated block (7 lines × 2) naga/src/back/hlsl/writer.rs
  • Code Duplication · Duplicated block (7 lines × 2) naga/src/front/spv/next_block.rs
  • Code Duplication · Duplicated block (7 lines × 2) naga/src/front/wgsl/lower/mod.rs
  • Code Duplication · Duplicated block (6 lines × 4) naga/src/front/spv/mod.rs
  • Code Duplication · Duplicated block (6 lines × 3) naga/src/back/hlsl/writer.rs
  • Code Duplication · Duplicated block (6 lines × 3) naga/src/front/spv/mod.rs
  • Code Duplication · Duplicated block (6 lines × 2) naga/src/back/hlsl/writer.rs
  • Code Duplication · Duplicated block (6 lines × 2) naga/src/front/spv/next_block.rs
  • Code Duplication · Duplicated block (6 lines × 2) wgpu-core/src/binding_model.rs
  • Code Duplication · Duplicated block (5 lines × 12) naga/src/front/spv/next_block.rs
  • Code Duplication · Duplicated block (5 lines × 5) naga/src/back/hlsl/writer.rs
  • Code Duplication · Duplicated block (5 lines × 5) naga/src/front/spv/next_block.rs
  • Code Duplication · Duplicated block (5 lines × 2) naga/src/front/spv/next_block.rs
  • Code Duplication · Duplicated block (5 lines × 2) naga/src/front/wgsl/lower/mod.rs
  • Code Duplication · Duplicated block (6 lines × 3) wgpu-core/src/binding_model.rs
  • Code Duplication · Duplicated block (7 lines × 2) wgpu-core/src/command/compute.rs
  • Code Duplication · Duplicated block (7 lines × 2) wgpu-core/src/pipeline.rs
  • Code Duplication · Duplicated block (11 lines × 8) naga/src/back/msl/writer.rs
  • Code Duplication · Duplicated block (13 lines × 3) naga/src/back/msl/writer.rs
  • Code Duplication · Duplicated block (10 lines × 3) naga/src/back/msl/writer.rs
  • Code Duplication · Duplicated block (11 lines × 3) naga/src/back/msl/writer.rs
Rebuild cost: about €410,000 · Estimate
Cost to rebuild€140,000 to €690,000, for 2,275 to 7,217 hours of work, about 2.8 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×0.9 at a score of 65. 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: 273,188 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: We price the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.

Top priorities

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

1
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with main.rs.
Raises the score by about 4 points · Low effort · ADR Quality
2
Resolve the 1 End-of-life runtime finding(s) in Platform End-of-Life — start with rust-toolchain.toml.
Raises the score by about 3 points · Low effort · Platform End-of-Life
3
Resolve the 16 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (10), REDACTED (3), REDACTED (2).
Raises the score by about 4 points · Medium effort · Static Analysis (SAST)

Diagnosis: what the measurements show together

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

Files that change often carry extra risk · Combined risk
18 files are changed often and are hard to read, which makes them the likeliest places for a mistake. They also have under half their code tested, or were written almost entirely by one person, so a mistake there is less likely to be caught, or only one person knows the code well enough to avoid it. A change to these files therefore carries more risk than the overall score suggests.
Based on: Churn × Complexity Hotspots (29 files) · Code Coverage (148 files under half tested) · Bus Factor (0 files written almost entirely by one person) · The files: adapter.rs, writer.rs and wgpu_core.rs
What to do: Add tests to these files and have a second person review every change to them, starting with adapter.rs, writer.rs and wgpu_core.rs.
Where the investment is most exposed · Value at risk
This code would cost about €410,000 to build again, about 2.8 person-years of work. Its weakest lens is Security and Compliance, at 58 (Adequate). Security and Compliance is about how well the product is protected, and how it handles personal data. Because the weakest lens counts most in the score, work on Security and Compliance also moves the score most.
Based on: the rebuild estimate · the Security and Compliance grade · how much each lens counts
What to do: Start with the Security and Compliance 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 4 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.2 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 5% to 10% on every change. The history of the code shows how much it changes: about 80,285 lines over the last 90 days, which is about 325,600 lines a year. At that pace, the extra work comes to an estimated 37.1 to 222.6 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of our own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.

Architecture — 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.

427 modules, with 1938 dependencies between them. 7 loops run through 163 of the modules, marked above the diagonal.

The table shows the 40 modules with the most connections; 387 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 naga_types2 wgpu_types.buffer3 wgpu_types.error4 wgpu_types.limits5 naga.arena.range6 wgpu_types.features7 wgpu_types.texture8 naga.span9 wgpu_types.backend10 wgpu_types.origin_extent11 naga.valid12 wgpu_types.adapter13 wgpu_types.texture.format14 naga.ir15 wgpu_types.render16 naga.front.spv17 naga.back.spv18 naga.front.wgsl.parse.ast19 naga.back.glsl20 wgpu_hal.gles21 naga.back.msl.writer22 wgpu_hal.dx1223 naga.arena.unique_arena24 wgpu_hal25 naga.arena.handle26 wgpu_core.track27 naga.arena28 wgpu_core.resource29 wgpu_core.device.queue30 wgpu_core.pipeline31 wgpu_core.command32 wgpu_core.command.bundle33 wgpu_core.device.resource34 wgpu_core.binding_model35 wgpu_core.command.render36 wgpu.backend.wgpu_core37 wgpu_core_remote.global38 wgpu.dispatch39 wgpu.backend.webgpu40 wgpu.api.device
1 naga_types
2 wgpu_types.buffer
3 wgpu_types.error
4 wgpu_types.limits
5 naga.arena.range11
6 wgpu_types.features1
7 wgpu_types.texture341
8 naga.span113
9 wgpu_types.backend111
10 wgpu_types.origin_extent11
11 naga.valid19162221
12 wgpu_types.adapter1111
13 wgpu_types.texture.format131
14 naga.ir121462152
15 wgpu_types.render3
16 naga.front.spv111162172
17 naga.back.spv4228355151
18 naga.front.wgsl.parse.ast14713131
19 naga.back.glsl3122
20 wgpu_hal.gles212434214314434
21 naga.back.msl.writer2223222291
22 wgpu_hal.dx1221232553511140
23 naga.arena.unique_arena2211
24 wgpu_hal1233220161265438
25 naga.arena.handle11
26 wgpu_core.track42533
27 naga.arena121
28 wgpu_core.resource42412051510141
29 wgpu_core.device.queue412121432
30 wgpu_core.pipeline21011831220442
31 wgpu_core.command10316102412
32 wgpu_core.command.bundle42731237421
33 wgpu_core.device.resource131312112541018129
34 wgpu_core.binding_model162141121423
35 wgpu_core.command.render63211113321558332
36 wgpu.backend.wgpu_core213321113435941802
37 wgpu_core_remote.global1121511222571322151
38 wgpu.dispatch21332813433723131
39 wgpu.backend.webgpu1314431912664131129280
40 wgpu.api.device1113133121
Uses a module listed above itPart of a loopThe module itself
1 naga_types2 wgpu_types.buffer3 wgpu_types.error4 wgpu_types.limits5 naga.arena.range6 wgpu_types.features7 wgpu_types.texture8 naga.span9 wgpu_types.backend10 wgpu_types.origin_extent11 naga.valid12 wgpu_types.adapter13 wgpu_types.texture.format14 naga.ir15 wgpu_types.render16 naga.front.spv17 naga.back.spv18 naga.front.wgsl.parse.ast19 naga.back.glsl20 wgpu_hal.gles21 naga.back.msl.writer22 wgpu_hal.dx1223 naga.arena.unique_arena24 wgpu_hal25 naga.arena.handle26 wgpu_core.track27 naga.arena28 wgpu_core.resource29 wgpu_core.device.queue30 wgpu_core.pipeline31 wgpu_core.command32 wgpu_core.command.bundle33 wgpu_core.device.resource34 wgpu_core.binding_model35 wgpu_core.command.render36 wgpu.backend.wgpu_core37 wgpu_core_remote.global38 wgpu.dispatch39 wgpu.backend.webgpu40 wgpu.api.devicenaga_types1wgpu_types.buffer2wgpu_types.error3wgpu_types.limits4naga.arena.range5wgpu_types.features6wgpu_types.texture7naga.span8wgpu_types.backend9wgpu_types.origin_extent10naga.valid11wgpu_types.adapter12wgpu_types.texture.format13naga.ir14wgpu_types.render15naga.front.spv16naga.back.spv17naga.front.wgsl.parse.ast18naga.back.glsl19wgpu_hal.gles20naga.back.msl.writer21wgpu_hal.dx1222naga.arena.unique_arena23wgpu_hal24naga.arena.handle25wgpu_core.track26naga.arena27wgpu_core.resource28wgpu_core.device.queue29wgpu_core.pipeline30wgpu_core.command31wgpu_core.command.bundle32wgpu_core.device.resource33wgpu_core.binding_model34wgpu_core.command.render35wgpu.backend.wgpu_core36wgpu_core_remote.global37wgpu.dispatch38wgpu.backend.webgpu39wgpu.api.device401113411131111119162221111113112146215231111621724228355151147131313122212434214314434222322229121232553511140221112332201612654381142533121424120515101414121214322101183122044210316102412427312374211313121125410181291621411214236321111332155833221332111343594180211215112225713221512133281343372313113144319126641311292801113133121+387 more modules (most-connected shown)

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

At a glance — Architecture · 93% · Exemplary ·

At a glance — Maturity · 65% · Adequate ·

At a glance — Readiness · 73% · Strong ·

At a glance — Security · 58% · 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

Top priorities: Resolve the 16 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (10), REDACTED (3), REDACTED (2); Resolve the 1 No ADRs found finding(s) in ADR Quality — start with main.rs; 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.

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 — start with main.rs.+4.0 ptsLowADR Quality
Resolve the 1 End-of-life runtime finding(s) in Platform End-of-Life — start with rust-toolchain.toml.+2.6 ptsLowPlatform End-of-Life
Resolve the 16 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (10), REDACTED (3), REDACTED (2).+4.3 ptsMediumStatic Analysis (SAST)
Resolve the 3 Orphaned knowledge finding(s) in Knowledge Freshness — start with storage.rs, declarations.rs, expressions.rs.+1.7 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.+3.0 ptsMediumDocumentation accuracy
Resolve the 1 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED.+1.3 ptsLowStatic Analysis (SAST)
Resolve the 4 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (4).+1.3 ptsLowStatic Analysis (SAST)
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.+2.5 ptsMediumArchitecture documentation

File quality

Per-file score 0–10 — a quality signature. Of 419 files carrying findings, judged against the Production bar: 1% slop · 48% mixed · 51% near-clean.

FileScoreBandWorst signal
wgpu-hal/src/gles/adapter.rs1.0SlopChange Coupling: Boundary-crossing change coupling: adapter.rs ↔ human.rs
wgpu-hal/src/vulkan/adapter.rs1.0SlopChange 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
wgpu-info/src/human.rs3.6SlopChange Coupling: Boundary-crossing change coupling: human.rs ↔ webgpu.rs
REDACTED4.4MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.8MixedDependency Vulnerabilities: Medium advisory (unmaintained): REDACTED
REDACTED5.1MixedStatic Analysis (SAST): High: REDACTED
REDACTED5.1MixedStatic Analysis (SAST): High: REDACTED
wgpu-core/src/validation.rs5.5MixedCyclomatic Complexity: Interface::check_stage (cyclomatic 89)
wgpu-core/src/command/ray_tracing.rs5.5MixedCyclomatic Complexity: wgpu_core::command::ray_tracing::iter_blas (cyclomatic 49)
naga/src/back/pipeline_constants.rs5.5MixedCyclomatic Complexity: naga::back::pipeline_constants::adjust_stmt (cyclomatic 46)
naga/src/back/spv/mesh_shader.rs5.5MixedCyclomatic Complexity: Writer::write_entry_point_mesh_shader_info (cyclomatic 29)
wgpu-core/src/command/bundle.rs5.5MixedCyclomatic Complexity: RenderBundle::execute (cyclomatic 26)
wgpu-core/src/track/texture.rs5.5MixedCyclomatic Complexity: wgpu_core::track::texture::update (cyclomatic 21)
wgpu/src/backend/wgpu_core.rs5.5MixedCyclomatic Complexity: CoreDevice::create_bind_group (cyclomatic 19)
wgpu-core/src/command/compute.rs5.5MixedCyclomatic Complexity: wgpu_core::command::compute::encode_compute_pass (cyclomatic 17)
wgpu-core/src/indirect_validation/dispatch.rs5.5MixedGod Classes: MethodTooLong: Dispatch.new
wgpu-core/src/pipeline.rs5.5MixedGod Classes: FileTooLong: src/pipeline.rs
player/src/lib.rs5.5MixedCyclomatic Complexity: Player::process (cyclomatic 57)

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

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

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

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

Could not be resolved — 11

Something this survey could not settle from the outside, and which could be critical or serious. Either a control was required and no positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean result. These are excluded from the score rather than awarded a pass, so the number on the cover neither rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each one is named under Limitations.

Methodology & how to trust this report

This survey is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. All 46 evaluated dimensions are computed by tools and static analysis; no language model sets or judges any of them. Overall confidence is 0.9, the weighted average across measured dimensions.

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

What we checked — 46 dimensions across the health lenses
D1D2D3D4D5D6D8D12D13D14D15D16D17D19D20D26D28D29D30D34D35D36D37D43D44AX10AX3AX4AX8AX9M1M2M3M4P1P10P2P3P4P6PF1PF3X1X21X29X30

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, 2100 of 2121 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 or a scanner, 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
Canine Code Analyzer 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

Every finding is locatable in findings.md. Run 01a1d8cb-c806-7b0f-b4b8-735419855802.

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.

  • D11 Test Reliability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test source is present (.rs) and this repository declares a Cargo test suite (repository root, 109 test files), but it was not re-run: its build outgrew the 7 GB scratch ceiling (10.145 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.
  • D19 Documentation Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each ecosystem's manifests (what makes a folder runnable or a published package) need their own proof before D19 judges its units. Until then those folders' READMEs are judged only as documents (boilerplate, structure), never counted as complete.
  • D21 Naming Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D21's naming rules read C# through Roslyn and every other language through its sidecar model; these languages are left out (PHP's reading is its own change, a Roslyn-loaded VB or F# project has no population builder yet). Their declarations carry no naming verdict this run — this says nothing about whether their names are consistent.
  • D21 Naming Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
  • D22 Internal API Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22'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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Each source language's comment syntax, and the code a comment annotates in it, needs its own proof before D24 judges it. Until then those comments are left unread, not counted as clean.
  • D27 Navigability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check 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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 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. We then boot 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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby and Scala source only, and this repository's 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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby and Scala source only, and this repository's 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 — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9), and artefact counts an order of magnitude off. Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
  • P5 DR & Backup — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. No backup/snapshot/replication config, RTO/RPO or restore-procedure documentation was found — and no production persistence was detected either (no data-access packages, no data-store services, no database resources), so there is nothing in this repository whose loss a DR control would recover. If this system's data lives in a platform or ops repo we can't see, that's where the DR evidence belongs.
  • X12 Unreachable branch — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
  • X5 Nullable reference types — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax and MSBuild project configuration, TypeScript source and its tsconfig files, Java source and its package and module declarations, PHP source and its PHPStan and Psalm configuration, Dart source and its pubspec language version, Ruby source and its Sorbet and Steep configuration, Scala source and its build's explicit-nulls, WartRemover and Scalafix settings, 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

We assess the repository exactly as committed, and only the repository. By design we do not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.

Per-dimension blind spots

For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.

  • D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
  • D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
  • D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
  • D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
  • 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.
  • D8 Code Coverage: Coverage is measured by building and running the test suite inside our isolated image — the target repo is never modified, and nothing on your systems runs. So coverage exists only when the suite builds and runs within the inline time budget; one that needs external services, can't build, or exceeds the budget yields no coverage (D8 then degrades to not-measured, not a low score). Line coverage also says nothing about assertion quality.
  • D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
  • D13 Secret Scanning: Secret detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
  • D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
  • D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
  • D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
  • D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
  • D19 Documentation Quality: Documentation quality publishes two things only: a runnable or packaged unit with no example, and a multi-project root README that maps none of its parts. It does not judge clarity, and its other checks (overview, licence, boilerplate, structure, empty sections, XML-doc coverage) are withheld after adjudication: their candidates are counted in the card's gaps, not shown as rows. A false statement in a document is M4's; units are .NET projects only.
  • D20 ADR Quality: ADR quality checks the structure of the decision records present: it cannot know about decisions made and never recorded, and it does not judge how well a record argues its case. Records in a language the section lexicon does not cover are not evaluated.
  • 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: Documentation accuracy checks links, versions and artefact counts against the tree: other claims (paths, commands, settings, routes) are read but not checked, and it cannot run the onboarding or measure how long a real new joiner takes.
  • P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
  • P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.

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

215 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was Writer::write_expr at 300. A further 71 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), wgpu-types/src/features.rs (Features::from_name at 80), naga/src/common/wgsl/to_wgsl.rs (MathFunction::try_to_wgsl 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) · ×48naga/src/back/glsl/writer.rs:2445
Device::create_render_pipeline_or_error_inner (cyclomatic 105) · ×21wgpu-core/src/device/resource.rs:4737
naga::front::glsl::builtins::inject_standard_builtins (cyclomatic 177) · ×18naga/src/front/glsl/builtins.rs:462
Frontend::next_block (cyclomatic 290) · ×13naga/src/front/spv/next_block.rs:22
CommandEncoder::begin_render_pass (cyclomatic 34) · ×11wgpu-hal/src/gles/command.rs:498

+ 52 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 290), BlockContext::cache_expression_value (cyclomatic 251). — 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.

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

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

Writer::write_functions (cognitive 559) · ×63naga/src/back/msl/writer.rs:7050
Device::create_render_pipeline_or_error_inner (cognitive 207) · ×27wgpu-core/src/device/resource.rs:4737
naga::front::glsl::builtins::inject_standard_builtins (cognitive 135) · ×21naga/src/front/glsl/builtins.rs:462
Frontend::next_block (cognitive 349) · ×18naga/src/front/spv/next_block.rs:22
CommandEncoder::begin_render_pass_inner::fill_arc_desc (cognitive 74) · ×17wgpu-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 559), Writer::write_expr (cognitive 397), Validator::validate_block_impl (cognitive 355). — 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.9/10, projected with the scoring formula itself and assuming each lands exactly at 240; a cleaner split scores higher.

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

324 god class(es) detected.

MethodTooLong: Frontend.next_block · ×157naga/src/front/spv/next_block.rs:22
FileTooLong: msl/writer.rs · ×88naga/src/back/msl/writer.rs
FunctionTooLong: naga::front::glsl::builtins::inject_standard_builtins · ×30naga/src/front/glsl/builtins.rs:462
ClassTooLong: Device · ×23wgpu-core/src/device/resource.rs:237
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 157 MethodTooLong finding(s) in God Classes — start with device.rs (18), mod.rs (17), writer.rs (16). — One of this dimension's main actionable groups (157 warning-level).
  2. Resolve the 88 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 (88 warning-level).
  3. Resolve the 30 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 (30 warning-level).

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

D4 · Code Duplication7.7 / 10Strong✓ Tool-verified

What it measures: How much of the production code is copy-pasted: the share of production lines inside a reported copy (every copy of a duplicated block or of an edited member, each line once), 10 at none and 0 at a quarter of the lines.

Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), scored on the share of production lines inside a reported copy (each line once; 10 at none, 0 at a quarter). Deterministic.

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

407 duplicated block group(s) detected. 5.9 % of the production lines (16,002 of 273,188) are in a reported copy. A further 206 rows report members as variants of one another; the share counts each copied line once, however many rows cite it.

Duplicated block (7 lines × 2) · ×26deno_webgpu/lib.rs:396
Duplicated block (11 lines × 2) · ×25naga/src/back/glsl/writer.rs:3211
Duplicated block (10 lines × 2) · ×24naga/src/back/glsl/writer.rs:1692
Duplicated block (6 lines × 2) · ×23naga/src/back/glsl/writer.rs:3564
Duplicated block (8 lines × 2) · ×22naga/src/back/dot/mod.rs:221

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

What to do

  1. Resolve the 26 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 (26 warning-level).
  2. Resolve the 25 Duplicated block (11 lines × 2) finding(s) in Code Duplication — start with writer.rs (7), dispatch.rs (3), constant_evaluator.rs (2). — One of this dimension's main actionable groups (25 warning-level).
  3. Resolve the 24 Duplicated block (10 lines × 2) finding(s) in Code Duplication — start with writer.rs (6), builtins.rs (3), mod.rs (2). — One of this dimension's main actionable groups (24 warning-level).

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).

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 437 classes have LCOM4 above 3.

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

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).

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

D8 · Code Coverage7.0 / 10Adequate✓ Tool-verified

What it measures: How much of the code is actually exercised by tests.

Method: Coverage from the analyzer's own run of the suite, computed per-file with structured exclusions for generated, trivial, and glue code. A coverage report found in the repository is never read. When the suite can't be built/run in-image, coverage is reported NOT-MEASURED (excluded from the score) with the precondition to make it measurable — never a LoC-ratio proxy folded in as if measured. Deterministic.

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

Line coverage 34.2% — 286 file(s) below 50%. Measured from the Rust suite (repository root: `cargo test --workspace` instrumented over 444 production file(s), 41 test binaries and 36 doc-test binaries).

Low coverage: benches/src/context.rs · ×286benches/src/context.rs:1

What to do

  1. Resolve the 286 Low coverage finding(s) in Code Coverage — start with mod.rs (48), main.rs (10), lib.rs (8). — One of this dimension's main actionable groups (286 warning-level).

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

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

What it measures: Whether dependencies are current, not deprecated, and not bloated. Known vulnerabilities are D30's.

Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (capped-linear for deprecation, prerelease and outdated) per KLoC. Known-vulnerable packages are D30's and are not charged here (rubric-2026.11.2). Exhaustive.

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

5 outdated, 0 yanked direct Cargo dependencies. 114 of 115 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 · ×5

✓ 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 535 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 Hotspots8.9 / 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 8.9 / 10 · rule-coverage 100% · ceiling Documented

Top hotspots: wgpu-core/src/device/resource.rs (55×105=5775); wgpu-hal/src/metal/adapter.rs (21×135=2835); naga/src/back/msl/writer.rs (11×207=2277)

Hotspot: wgpu-core/src/device/resource.rs · ×42wgpu-core/src/device/resource.rs:4737

What to do

  1. Resolve the 42 Hotspot finding(s) in Churn × Complexity Hotspots — start with writer.rs (5), adapter.rs (4), mod.rs (4). — One of this dimension's main actionable groups (42 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

18 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is wgpu-types/src/bitflags_array.rs. Counted over 382 of the 469 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 263 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

281 deducted task-comment markers across 273188 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 · ×240wgpu-types/src/adapter.rs:142
HackComment · ×13wgpu-core/src/instance.rs:695
FixmeComment · ×7wgpu-types/src/write_only.rs:40
XxxComment · ×2wgpu-types/src/counters.rs:189
TodoComment repeated across 17 filesdeno_webgpu/bind_group.rs:56

What to do

  1. Resolve the 240 TodoComment finding(s) in Explicit Debt — start with mod.rs (32), writer.rs (22), adapter.rs (20). — One of this dimension's main actionable groups (240 warning-level).
  2. Resolve the 13 HackComment finding(s) in Explicit Debt — start with next_block.rs (4), mod.rs (2), block.rs (2). — One of this dimension's main actionable groups (13 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).

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: Every ADR read by its section structure: nine located rules (a missing Decision, Context or Consequences section, a stale status, two records deciding the same question, a dangling supersede link, a number-only title, a single option, no named cost, no status where the log uses one, no enforcement field where the log adopted one), each a fixed deduction from 10; the score is the mean over evaluated records. Deterministic, no model. Advisory.

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

No architecture decision records were found.

No ADRs foundwgpu-info/src/main.rs:1

What to do

  1. Resolve the 1 No ADRs found finding(s) in ADR Quality — start with main.rs. — 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.

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 1368, line 1442, line 1444, …), `wgpu-core/src/device/resource.rs` (line 369, lines 370–371), `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.7 / 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. Advisory since rubric-2026.11.2 (CAI decision 0006): every row is a match against a vulnerability database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.

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

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

REDACTED
REDACTED

What to do

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

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

D34 · Knowledge Freshness9.4 / 10Adequategated by 3 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 382 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is naga/src/back/hlsl/storage.rs. Counted over 382 of the 469 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Orphaned knowledge · ×3naga/src/back/hlsl/storage.rs:1
Orphaned file · ×20naga/src/front/glsl/parser/types.rs:1
Further orphaned files (smaller)

What to do

  1. Resolve the 3 Orphaned knowledge finding(s) in Knowledge Freshness — start with storage.rs, declarations.rs, expressions.rs. — One of this dimension's main actionable groups (3 issue-level).
  2. Resolve the 20 Orphaned file finding(s) in Knowledge Freshness — start with types.rs, continue_forward.rs, ast.rs. — One of this dimension's main actionable groups (20 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 6 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%; draw.rs↔mod.rs 67%

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

What to do

  1. Resolve the 6 Boundary-crossing change coupling finding(s) in Change Coupling — start with adapter.rs (4), conv.rs, human.rs. — One of this dimension's main actionable groups (6 issue-level).
  2. 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).
  3. Resolve the 1 Change coupling finding(s) in Change Coupling — start with buffer.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. Reported apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.

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

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.

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)9.0 / 10Exemplary✓ Tool-verified

Maturity · Maturity — Whether the repository and its projects have a README, and whether it is substantive.

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

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 repository is organised deliberately: production code and tests are set apart in a way its ecosystem or the repository itself declares.

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

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

Maturity · Maturity — Whether the project's current-state documentation describes the code that exists.

Method: Every current-state document's checkable claims looked up in the tree (links, versions, and artefact counts an order of magnitude off), plus two README checks: an advertised infrastructure product with no footprint, and a module the CHANGELOG records as removed. Deterministic, no model. Advisory.

  • 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's code model records as public (Rust, Swift, Java, Kotlin, Go, Dart; not measured where the model records no type visibility or, as in TypeScript, only module-level export), and its version is read from the manifest, a semver CHANGELOG, release tooling or semver git tags. Exhaustive, deterministic.

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 each language's code model, a blocking call inside an async function (Python, TS/JS, Rust, Kotlin, Swift, Dart) or inside a Java method returning a Reactor Mono/Flux or a Scala method returning a Future or effect — and, for a .NET library with ≥5 awaits, the share of awaits using ConfigureAwait(false). Deterministic, syntax/text detection.

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.

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.

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.

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 Health80%Adequate — gated by D2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture93%ExemplaryStrongest area.
Maturity65%AdequateAcceptable, with room to improve.
Readiness73%StrongSolid.
Security58%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 — 67 check(s) not relevant to this codebase

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

  • AC1 Text alternatives — No web markup found — accessibility is not applicable to this repository.
  • AC2 Forms & labels — No web markup found — accessibility is not applicable to this repository.
  • AC3 Page structure — No web markup found — accessibility is not applicable to this repository.
  • AC4 Keyboard semantics — No web markup found — accessibility is not applicable to this repository.
  • AC5 ARIA correctness — No web markup found — accessibility is not applicable to this repository.
  • AC6 Visual & motion safety — No web markup found — accessibility is not applicable to this repository.
  • AX1 Captive dependencies — Not 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 — ~72981 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 does not read html yet; 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+ sibling projects each declaring an entity of their own or taking another project's integration events. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
  • D24 Comment Value — D24 reads C#, Visual Basic, TypeScript and JavaScript comments only; comments in this repository's .rs source were not judged.
  • 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.
  • 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
  • DM1 Domain Modelling — not scored — this repository shows only 1 of the 3 signals this lens looks for (175 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 — coverage data present for 444 file(s), but no domain-layer files were identified: no covered file's path contains any of the markers this check keys on (/domain/, /aggregates/, /valueobjects/, /domainmodel/, .domain/, /entities/), which are matched case-insensitively anywhere in the path. With no domain partition there is nothing to compare the web/controller layer against — if this repository keeps its business rules under a folder named none of those, that naming is what the check cannot see, not the domain logic.
  • PF2 Allocation hygiene — Not scored: this check counted allocation-aware idioms (Span, pools, stackalloc) per line, which describes what kind of code a repository is rather than whether it has an allocation problem, so it was withdrawn. Nothing here is a finding about your code.
  • S1 Web-Security Posture — No web surface: 499 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.
  • X12 Unreachable branch — X12 reached only 1% of this repository's production lines — rust (273,188 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X13 Undrained process stream — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X14 Bypassable address classification — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X15 Unvalidated length from an untrusted reader — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X16 Unfloored truncation loop — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X17 Uncapped recursion over a caller-supplied document — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X18 Disposal-pattern correctness — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X19 Unrestored process-global state — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X2 Cancellation propagation — no C# was loaded; this repository's 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.
  • X22 Contradicted release guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X23 Unguarded diagnostic materialisation — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X24 Document value interpolated into markup unescaped — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X25 Inert configuration knob — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X26 Unsynchronised callback handoff — Not applicable: 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.
  • X27 Collection changed while being enumerated — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X28 Index access outside its own emptiness guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X3 Exception handling — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • 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 — 30 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 · ×6
  • 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 66% of the time (37 of the 56 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 37 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: 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/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: 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.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D34 · Knowledge Freshness · Orphaned knowledge · ×3
  • 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 — 2039 finding(s)
D8 · Code Coverage · Low coverage · ×286
  • Low coverage: benches/src/context.rs benches/src/context.rs:1 — 0.0% line coverage (0/11).
  • Low coverage: benches/src/file.rs benches/src/file.rs:1 — 0.0% line coverage (0/18).
  • Low coverage: benches/src/iter.rs benches/src/iter.rs:1 — 0.0% line coverage (0/73).
  • Low coverage: benches/src/lib.rs benches/src/lib.rs:1 — 0.0% line coverage (0/124).
  • Low coverage: benches/src/print.rs benches/src/print.rs:1 — 0.0% line coverage (0/155).
  • Low coverage: cts_runner/src/main.rs cts_runner/src/main.rs:1 — 0.0% line coverage (0/112).
  • Low coverage: deno_webgpu/adapter.rs deno_webgpu/adapter.rs:1 — 0.0% line coverage (0/360).
  • Low coverage: deno_webgpu/bind_group.rs deno_webgpu/bind_group.rs:1 — 0.0% line coverage (0/66).
  • Low coverage: deno_webgpu/bind_group_layout.rs deno_webgpu/bind_group_layout.rs:1 — 0.0% line coverage (0/82).
  • Low coverage: deno_webgpu/buffer.rs deno_webgpu/buffer.rs:1 — 0.0% line coverage (0/205).
  • Low coverage: deno_webgpu/byow.rs deno_webgpu/byow.rs:1 — 0.0% line coverage (0/129).
  • Low coverage: deno_webgpu/command_buffer.rs deno_webgpu/command_buffer.rs:1 — 0.0% line coverage (0/11).
  • Low coverage: deno_webgpu/command_encoder.rs deno_webgpu/command_encoder.rs:1 — 0.0% line coverage (0/285).
  • Low coverage: deno_webgpu/compute_pass.rs deno_webgpu/compute_pass.rs:1 — 0.0% line coverage (0/135).
  • Low coverage: deno_webgpu/compute_pipeline.rs deno_webgpu/compute_pipeline.rs:1 — 0.0% line coverage (0/18).
  • Low coverage: deno_webgpu/device.rs deno_webgpu/device.rs:1 — 0.0% line coverage (0/640).
  • Low coverage: deno_webgpu/error.rs deno_webgpu/error.rs:1 — 0.0% line coverage (0/160).
  • Low coverage: deno_webgpu/lib.rs deno_webgpu/lib.rs:1 — 32.1% line coverage (84/262).
  • Low coverage: deno_webgpu/pipeline_layout.rs deno_webgpu/pipeline_layout.rs:1 — 0.0% line coverage (0/11).
  • Low coverage: deno_webgpu/query_set.rs deno_webgpu/query_set.rs:1 — 0.0% line coverage (0/26).
  • Low coverage: deno_webgpu/queue.rs deno_webgpu/queue.rs:1 — 0.0% line coverage (0/91).
  • Low coverage: deno_webgpu/render_bundle.rs deno_webgpu/render_bundle.rs:1 — 0.0% line coverage (0/231).
  • Low coverage: deno_webgpu/render_pass.rs deno_webgpu/render_pass.rs:1 — 0.0% line coverage (0/297).
  • Low coverage: deno_webgpu/render_pipeline.rs deno_webgpu/render_pipeline.rs:1 — 0.0% line coverage (0/131).
  • Low coverage: deno_webgpu/sampler.rs deno_webgpu/sampler.rs:1 — 0.0% line coverage (0/38).
  • + 261 more in this group — see findings.md.
D17 · Explicit Debt · TodoComment · ×240
  • 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:143 — // 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:1344 — // 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:1721 — // 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:1928 — // 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:2064 — // TODO(https://github.com/gfx-rs/wgpu/issues/9742): enable on
  • TodoComment wgpu-hal/src/vulkan/adapter.rs:2363 — // 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:2500 — //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:2553 — //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:2575 — //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:2911 — // 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:2960 — // 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:245 — // 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:3491 — // 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.
  • + 215 more in this group — see findings.md.
D3 · God Classes · MethodTooLong · ×157
  • MethodTooLong: Frontend.next_block naga/src/front/spv/next_block.rs:22 — MethodTooLong — next_block runs 2224 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 2124 over it, 22.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.
  • 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:680 — MethodTooLong — as_parse_error runs 823 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 723 over it, 8.23× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Validator.validate_block_impl naga/src/valid/function.rs:812 — MethodTooLong — validate_block_impl runs 795 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 695 over it, 7.95× 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:386 — MethodTooLong — validate_expression runs 769 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 669 over it, 7.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_expr naga/src/back/hlsl/writer.rs:3939 — MethodTooLong — write_expr runs 663 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 563 over it, 6.63× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Lowerer.call_builtin naga/src/front/wgsl/lower/mod.rs:3142 — MethodTooLong — call_builtin runs 657 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 557 over it, 6.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.
  • MethodTooLong: Adapter.expose wgpu-hal/src/dx12/adapter.rs:159 — MethodTooLong — expose runs 656 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 556 over it, 6.56× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Writer.write_stmt naga/src/back/hlsl/writer.rs:2388 — MethodTooLong — write_stmt runs 647 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 547 over it, 6.47× 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 573 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 473 over it, 5.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.
  • 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: Device.create_render_pipeline_or_error_inner wgpu-core/src/device/resource.rs:4737 — MethodTooLong — create_render_pipeline_or_error_inner runs 460 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 360 over it, 4.60× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • 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:3271 — 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: ConstantEvaluator.math naga/src/proc/constant_evaluator.rs:1481 — 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: Writer.write_stmt naga/src/back/wgsl/writer.rs:750 — MethodTooLong — write_stmt runs 415 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 315 over it, 4.15× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ResolveContext.resolve naga/src/proc/typifier.rs:265 — MethodTooLong — resolve runs 412 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 312 over it, 4.12× 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 402 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 302 over it, 4.02× 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: Lowerer.statement naga/src/front/wgsl/lower/mod.rs:1812 — MethodTooLong — statement runs 394 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 294 over it, 3.94× 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:1313 — MethodTooLong — write_function runs 393 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 293 over it, 3.93× 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:715 — MethodTooLong — new runs 388 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 288 over it, 3.88× 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: Writer.write_expr_plain_form naga/src/back/wgsl/writer.rs:1564 — MethodTooLong — write_expr_plain_form runs 380 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 280 over it, 3.80× 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.
  • + 132 more in this group — see findings.md.
D3 · God Classes · FileTooLong · ×88
  • FileTooLong: msl/writer.rs naga/src/back/msl/writer.rs — FileTooLong — 6158 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 5658 over it, 12.32× 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/writer.rs naga/src/back/hlsl/writer.rs — FileTooLong — 3714 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 (163-5146). The bar is 500 significant lines; this is 3214 over it, 7.43× 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: device/resource.rs wgpu-core/src/device/resource.rs — FileTooLong — 3673 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, 237-5776). The bar is 500 significant lines; this is 3173 over it, 7.35× 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 — 3532 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 79% of them inside a single declaration: Lowerer (2 blocks, 1282-5437). The bar is 500 significant lines; this is 3032 over it, 7.06× 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/webgpu.rs wgpu/src/backend/webgpu.rs — FileTooLong — 3101 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 2601 over it, 6.20× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: command/render.rs wgpu-core/src/command/render.rs — FileTooLong — 3095 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 2595 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: spv/block.rs naga/src/back/spv/block.rs — FileTooLong — 2894 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 2394 over it, 5.79× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: proc/constant_evaluator.rs naga/src/proc/constant_evaluator.rs — FileTooLong — 2838 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-3808). The bar is 500 significant lines; this is 2338 over it, 5.68× 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 — 2831 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 2331 over it, 5.66× 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 — 2763 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-4136). The bar is 500 significant lines; this is 2263 over it, 5.53× 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 — 2517 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 2017 over it, 5.03× 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 — 2307 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 1807 over it, 4.61× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: vulkan/device.rs wgpu-hal/src/vulkan/device.rs — FileTooLong — 2286 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-3194). The bar is 500 significant lines; this is 1786 over it, 4.57× 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/next_block.rs naga/src/front/spv/next_block.rs — FileTooLong — 2252 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-3105). The bar is 500 significant lines; this is 1752 over it, 4.50× 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 — 2132 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-3212). The bar is 500 significant lines; this is 1632 over it, 4.26× 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 — 2121 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 1621 over it, 4.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: dx12/device.rs wgpu-hal/src/dx12/device.rs — FileTooLong — 1926 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-2801). The bar is 500 significant lines; this is 1426 over it, 3.85× 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: metal/device.rs wgpu-hal/src/metal/device.rs — FileTooLong — 1680 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, 186-2380). The bar is 500 significant lines; this is 1180 over it, 3.36× 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 — 1630 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 81% of them inside a single declaration: Validator (371-2265). The bar is 500 significant lines; this is 1130 over it, 3.26× 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/validation.rs wgpu-core/src/validation.rs — FileTooLong — 1625 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 1125 over it, 3.25× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: 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: hlsl/help.rs naga/src/back/hlsl/help.rs — FileTooLong — 1616 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 1116 over it, 3.23× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: glsl/builtins.rs naga/src/front/glsl/builtins.rs — FileTooLong — 1579 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 1079 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: wgsl/writer.rs naga/src/back/wgsl/writer.rs — FileTooLong — 1500 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 (2 blocks, 82-2188). The bar is 500 significant lines; this is 1000 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: gles/queue.rs wgpu-hal/src/gles/queue.rs — FileTooLong — 1499 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-2014). The bar is 500 significant lines; this is 999 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.
  • + 63 more in this group — see findings.md.
D2 · Cognitive Complexity · Writer · ×63
  • Writer::write_functions (cognitive 559) naga/src/back/msl/writer.rs:7050 — Writer::write_functions has cognitive complexity 559 (threshold 15). Drivers by points: if/else 99 (325 pts), match/switch 34 (129 pts), loops 29 (86 pts), boolean chains 19 (nesting depth added 378). 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 397) naga/src/back/glsl/writer.rs:2445 — Writer::write_expr has cognitive complexity 397 (threshold 15). Drivers by points: if/else 106 (240 pts), match/switch 48 (126 pts), boolean chains 16, loops 5 (15 pts) (nesting depth added 222). To reduce it, split the body into named stages: move each independent 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:2388 — 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 192) naga/src/back/hlsl/writer.rs:3939 — Writer::write_expr has cognitive complexity 192 (threshold 15). Drivers by points: if/else 52 (114 pts), match/switch 27 (68 pts), boolean chains 8, loops 1 (2 pts) (nesting depth added 104). To reduce it, split the body into named stages: move each independent 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:1625 — 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 161) naga/src/back/msl/writer.rs:2218 — Writer::put_expression has cognitive complexity 161 (threshold 15). Drivers by points: if/else 40 (79 pts), match/switch 28 (69 pts), boolean chains 11, loops 1 (2 pts) (nesting depth added 81). To reduce it, split the body into named stages: move each independent 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 139) naga/src/back/msl/writer.rs:4133 — Writer::put_block has cognitive complexity 139 (threshold 15). Drivers by points: if/else 32 (93 pts), match/switch 8 (26 pts), loops 6 (16 pts), boolean chains 4 (nesting depth added 89). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • 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 127) naga/src/back/spv/writer.rs:1313 — Writer::write_function has cognitive complexity 127 (threshold 15). Drivers by points: if/else 49 (96 pts), loops 8 (14 pts), match/switch 6 (12 pts), boolean chains 5 (nesting depth added 59). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Writer::write_stmt (cognitive 126) naga/src/back/wgsl/writer.rs:750 — Writer::write_stmt has cognitive complexity 126 (threshold 15). Drivers by points: if/else 34 (77 pts), loops 10 (23 pts), match/switch 10 (23 pts), boolean chains 3 (nesting depth added 69). To reduce it, split the body into named stages: move each independent 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 79) naga/src/back/hlsl/writer.rs:1680 — Writer::write_function has cognitive complexity 79 (threshold 15). Drivers by points: if/else 32 (58 pts), loops 5 (9 pts), match/switch 5 (8 pts), boolean chains 4 (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_math_expression (cognitive 76) naga/src/back/hlsl/writer.rs:3271 — 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_expr_plain_form (cognitive 71) naga/src/back/wgsl/writer.rs:1564 — Writer::write_expr_plain_form has cognitive complexity 71 (threshold 15). Drivers by points: match/switch 17 (33 pts), if/else 16 (32 pts), loops 2 (5 pts), boolean chains 1 (nesting depth added 35). 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 (cognitive 70) naga/src/back/hlsl/writer.rs:336 — Writer::write has cognitive complexity 70 (threshold 15). Drivers by points: if/else 19 (45 pts), loops 9 (12 pts), match/switch 3 (10 pts), boolean chains 3 (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.
  • Writer::write_std140_compat_type_declaration (cognitive 66) naga/src/back/spv/writer.rs:2446 — 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 56) naga/src/back/spv/writer.rs:3814 — Writer::write_logical_layout has cognitive complexity 56 (threshold 15). Drivers by points: if/else 22 (34 pts), loops 12 (14 pts), boolean chains 4, match/switch 3 (4 pts) (nesting depth added 15). Of this number, 55 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_wrapped_functions (cognitive 53) naga/src/back/hlsl/help.rs:1999 — Writer::write_wrapped_functions has cognitive complexity 53 (threshold 15). Drivers by points: if/else 8 (27 pts), match/switch 9 (25 pts), loops 1 (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_global_variable (cognitive 52) naga/src/back/spv/writer.rs:3553 — 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:2223 — 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:3219 — 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::put_return_value (cognitive 49) naga/src/back/msl/writer.rs:3710 — Writer::put_return_value has cognitive complexity 49 (threshold 15). Drivers by points: if/else 11 (35 pts), loops 2 (8 pts), match/switch 3 (4 pts), boolean chains 2 (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.
  • Writer::write_type_defs (cognitive 49) naga/src/back/msl/writer.rs:4883 — 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.
  • + 38 more in this group — see findings.md.
D1 · Cyclomatic Complexity · Writer · ×48
  • Writer::write_expr (cyclomatic 300) naga/src/back/glsl/writer.rs:2445 — 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 207) naga/src/back/msl/writer.rs:2218 — Writer::put_expression has cyclomatic complexity 207 (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 190) naga/src/back/msl/writer.rs:7050 — Writer::write_functions has cyclomatic complexity 190 (threshold 15). To reduce it, separate the cases: extract each independent 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:3271 — 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 132) naga/src/back/hlsl/writer.rs:3939 — Writer::write_expr has cyclomatic complexity 132 (threshold 15). To reduce it, separate the cases: extract each independent 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 123) naga/src/back/hlsl/writer.rs:2388 — Writer::write_stmt has cyclomatic complexity 123 (threshold 15). To reduce it, separate the cases: extract each independent 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:1625 — 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::write_stmt (cyclomatic 103) naga/src/back/wgsl/writer.rs:750 — Writer::write_stmt has cyclomatic complexity 103 (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::put_block (cyclomatic 90) naga/src/back/msl/writer.rs:4133 — Writer::put_block 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 83) naga/src/back/wgsl/writer.rs:1564 — Writer::write_expr_plain_form 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.
  • Writer::map_binding (cyclomatic 73) naga/src/back/spv/writer.rs:3219 — 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 57) naga/src/back/spv/writer.rs:1313 — Writer::write_function has cyclomatic complexity 57 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • 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_logical_layout (cyclomatic 41) naga/src/back/spv/writer.rs:3814 — Writer::write_logical_layout has cyclomatic complexity 41 (threshold 15). Of this number, 40 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_function (cyclomatic 40) naga/src/back/hlsl/writer.rs:1680 — 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_enable_declarations (cyclomatic 39) naga/src/back/wgsl/writer.rs:287 — Writer::write_enable_declarations 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.
  • Writer::write (cyclomatic 35) naga/src/back/hlsl/writer.rs:336 — Writer::write has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • 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_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:6144 — 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_global (cyclomatic 26) naga/src/back/hlsl/writer.rs:1117 — Writer::write_global 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:596 — 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.
  • Writer::write_function (cyclomatic 25) naga/src/back/glsl/writer.rs:1235 — Writer::write_function 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.
  • Writer::write_ray_query_stmt (cyclomatic 25) naga/src/back/msl/ray.rs:195 — Writer::write_ray_query_stmt 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.
  • + 23 more in this group — see findings.md.
D15 · Churn × Complexity Hotspots · Hotspot · ×42
  • Hotspot: wgpu-core/src/device/resource.rs wgpu-core/src/device/resource.rs:4737 — wgpu-core/src/device/resource.rs changed 55 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 105 in Device::create_render_pipeline_or_error_inner at line 4737. 11 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 04:54:42 +00:00' --until='2026-11-14 04:54:42 +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:715 — wgpu-hal/src/metal/adapter.rs changed 21 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 135 in CapabilitiesQuery::new at line 715. 3 of those changes were fix/bug commits, and the other 18 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 04:54:42 +00:00' --until='2026-11-14 04:54:42 +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: naga/src/back/msl/writer.rs naga/src/back/msl/writer.rs:2218 — naga/src/back/msl/writer.rs changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 207 in Writer::put_expression at line 2218. 1 of those changes was a fix/bug commit, and the other 10 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 04:54:42 +00:00' --until='2026-11-14 04:54:42 +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: naga/src/back/glsl/writer.rs naga/src/back/glsl/writer.rs:2445 — naga/src/back/glsl/writer.rs changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 300 in Writer::write_expr at line 2445. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 04:54:42 +00:00' --until='2026-11-14 04:54:42 +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: wgpu/src/backend/wgpu_core.rs wgpu/src/backend/wgpu_core.rs:1077 — wgpu/src/backend/wgpu_core.rs changed 85 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 19 in CoreDevice::create_bind_group at line 1077. 2 of those changes were fix/bug commits, and the other 83 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 04:54:42 +00:00' --until='2026-11-14 04:54:42 +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: naga/src/back/hlsl/writer.rs naga/src/back/hlsl/writer.rs:3939 — naga/src/back/hlsl/writer.rs changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 132 in Writer::write_expr at line 3939. 3 of those changes were fix/bug commits, and the other 9 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 04:54:42 +00:00' --until='2026-11-14 04:54:42 +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-core/src/resource.rs wgpu-core/src/resource.rs:2108 — wgpu-core/src/resource.rs changed 32 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 45 in Texture::create_view_inner at line 2108. 4 of those changes were fix/bug commits, and the other 28 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 04:54:42 +00:00' --until='2026-11-14 04:54:42 +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: player/src/lib.rs player/src/lib.rs:105 — player/src/lib.rs changed 20 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 57 in Player::process at line 105. 1 of those changes was a fix/bug commit, and the other 19 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 04:54:42 +00:00' --until='2026-11-14 04:54:42 +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/validation.rs wgpu-core/src/validation.rs:1682 — wgpu-core/src/validation.rs changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 89 in Interface::check_stage at line 1682. 1 of those changes was a fix/bug commit, and the other 11 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 04:54:42 +00:00' --until='2026-11-14 04:54:42 +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 8 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 5 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 04:54:42 +00:00' --until='2026-11-14 04:54:42 +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: wgpu-hal/src/vulkan/adapter.rs wgpu-hal/src/vulkan/adapter.rs:1232 — wgpu-hal/src/vulkan/adapter.rs changed 22 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 48 in PhysicalDeviceProperties::get_required_extensions at line 1232. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 04:54:42 +00:00' --until='2026-11-14 04:54:42 +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: wgpu-hal/src/dx12/adapter.rs wgpu-hal/src/dx12/adapter.rs:159 — wgpu-hal/src/dx12/adapter.rs changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 103 in Adapter::expose at line 159. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 04:54:42 +00:00' --until='2026-11-14 04:54:42 +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: naga/src/valid/function.rs naga/src/valid/function.rs:812 — naga/src/valid/function.rs changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 149 in Validator::validate_block_impl at line 812. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 04:54:42 +00:00' --until='2026-11-14 04:54:42 +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: wgpu-hal/src/gles/queue.rs wgpu-hal/src/gles/queue.rs:192 — wgpu-hal/src/gles/queue.rs changed 5 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 04:54:42 +00:00' --until='2026-11-14 04:54:42 +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 9 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 04:54:42 +00:00' --until='2026-11-14 04:54:42 +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: wgpu-core/src/command/render.rs wgpu-core/src/command/render.rs:1219 — wgpu-core/src/command/render.rs changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 59 in RenderPassInfo::start at line 1219. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 04:54:42 +00:00' --until='2026-11-14 04:54:42 +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: naga/src/back/spv/block.rs naga/src/back/spv/block.rs:790 — naga/src/back/spv/block.rs changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 251 in BlockContext::cache_expression_value at line 790. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 04:54:42 +00:00' --until='2026-11-14 04:54:42 +00:00' --full-history --no-merges -- naga/src/back/spv/block.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:3142 — naga/src/front/wgsl/lower/mod.rs changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 74 in Lowerer::call_builtin at line 3142. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 04:54:42 +00:00' --until='2026-11-14 04:54:42 +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/valid/expression.rs naga/src/valid/expression.rs:386 — naga/src/valid/expression.rs changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 219 in Validator::validate_expression at line 386. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 04:54:42 +00:00' --until='2026-11-14 04:54:42 +00:00' --full-history --no-merges -- naga/src/valid/expression.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:1517 — wgpu-hal/src/metal/device.rs changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 50 in Device::create_render_pipeline at line 1517. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 04:54:42 +00:00' --until='2026-11-14 04:54:42 +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: naga/src/front/wgsl/error.rs naga/src/front/wgsl/error.rs:680 — naga/src/front/wgsl/error.rs changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 125 in Error::as_parse_error at line 680. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 04:54:42 +00:00' --until='2026-11-14 04:54:42 +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: naga/src/back/wgsl/writer.rs naga/src/back/wgsl/writer.rs:750 — naga/src/back/wgsl/writer.rs changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 103 in Writer::write_stmt at line 750. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 04:54:42 +00:00' --until='2026-11-14 04:54:42 +00:00' --full-history --no-merges -- naga/src/back/wgsl/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/src/backend/webgpu.rs wgpu/src/backend/webgpu.rs:3501 — wgpu/src/backend/webgpu.rs changed 32 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 18 in WebCommandEncoder::begin_render_pass at line 3501. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 04:54:42 +00:00' --until='2026-11-14 04:54:42 +00:00' --full-history --no-merges -- wgpu/src/backend/webgpu.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:3219 — naga/src/back/spv/writer.rs changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 73 in Writer::map_binding at line 3219. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 04:54:42 +00:00' --until='2026-11-14 04:54:42 +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: naga/src/back/dot/mod.rs naga/src/back/dot/mod.rs:65 — naga/src/back/dot/mod.rs changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 79 in StatementGraph::add 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 04:54:42 +00:00' --until='2026-11-14 04:54:42 +00:00' --full-history --no-merges -- naga/src/back/dot/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.
  • + 17 more in this group — see findings.md.
D3 · God Classes · FunctionTooLong · ×30
  • 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 374 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 274 over it, 3.74× 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:932 — FunctionTooLong — wgpu_core::device::trace::record::action_to_owned runs 274 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 174 over it, 2.74× 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:618 — FunctionTooLong — naga::back::dot::write_function_expressions runs 233 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 133 over it, 2.33× 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:197 — FunctionTooLong — wgpu_core::command::ray_tracing::build_acceleration_structures runs 226 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 126 over it, 2.26× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: 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: naga::back::pipeline_constants::adjust_stmt naga/src/back/pipeline_constants.rs:746 — FunctionTooLong — naga::back::pipeline_constants::adjust_stmt 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: 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: naga::back::pipeline_constants::adjust_expr naga/src/back/pipeline_constants.rs:488 — FunctionTooLong — naga::back::pipeline_constants::adjust_expr runs 190 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 90 over it, 1.90× 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 170 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 70 over it, 1.70× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: wgpu_hal::metal::icb_probe::supports_render_icb wgpu-hal/src/metal/icb_probe.rs:21 — FunctionTooLong — wgpu_hal::metal::icb_probe::supports_render_icb runs 168 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 68 over it, 1.68× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: 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 158 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 58 over it, 1.58× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: 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:3197 — 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::ray_tracing_pass::encode_ray_tracing_pass wgpu-core/src/command/ray_tracing_pass.rs:671 — FunctionTooLong — wgpu_core::command::ray_tracing_pass::encode_ray_tracing_pass runs 140 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 40 over it, 1.40× 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::conv::map_predeclared_type naga/src/front/wgsl/parse/conv.rs:449 — FunctionTooLong — naga::front::wgsl::parse::conv::map_predeclared_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::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.
  • + 5 more in this group — see findings.md.
D2 · Cognitive Complexity · Device · ×27
  • Device::create_render_pipeline_or_error_inner (cognitive 207) wgpu-core/src/device/resource.rs:4737 — Device::create_render_pipeline_or_error_inner has cognitive complexity 207 (threshold 15). Drivers by points: if/else 73 (154 pts), loops 10 (25 pts), boolean chains 16, match/switch 9 (12 pts) (nesting depth added 99). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • Device::create_render_pipeline (cognitive 88) wgpu-hal/src/metal/device.rs:1517 — Device::create_render_pipeline has cognitive complexity 88 (threshold 15). Drivers by points: if/else 28 (51 pts), match/switch 18 (21 pts), loops 5 (13 pts), boolean chains 3 (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::validate_texture_descriptor_inner (cognitive 73) wgpu-core/src/device/resource.rs:1827 — Device::validate_texture_descriptor_inner has cognitive complexity 73 (threshold 15). Drivers by points: if/else 39 (62 pts), boolean chains 4, match/switch 2 (4 pts), loops 2 (3 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • 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:1181 — 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:994 — 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::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:3093 — 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::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::load_shader (cognitive 42) wgpu-hal/src/metal/device.rs:187 — Device::load_shader has cognitive complexity 42 (threshold 15). Drivers by points: match/switch 8 (27 pts), if/else 4 (11 pts), boolean chains 2, loops 1 (2 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.
  • Device::texture_use_parameters (cognitive 39) wgpu-core/src/device/resource.rs:4150 — Device::texture_use_parameters has cognitive complexity 39 (threshold 15). Drivers by points: if/else 18 (33 pts), match/switch 3 (5 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.
  • Device::create_render_pipeline (cognitive 39) wgpu-hal/src/vulkan/device.rs:2108 — 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:1235 — 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:914 — 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::create_bind_group_layout (cognitive 29) wgpu-hal/src/vulkan/device.rs:1489 — 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:58 — 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::create_ray_tracing_pipeline_inner (cognitive 27) wgpu-core/src/device/ray_tracing.rs:392 — Device::create_ray_tracing_pipeline_inner has cognitive complexity 27 (threshold 15). Drivers by points: match/switch 8 (12 pts), if/else 6 (10 pts), loops 4 (5 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Device::maintain (cognitive 27) wgpu-core/src/device/resource.rs:1021 — 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_texture_view (cognitive 26) wgpu-hal/src/metal/device.rs:694 — Device::create_texture_view has cognitive complexity 26 (threshold 15). Drivers by points: if/else 21 (24 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_bind_group_inner (cognitive 24) wgpu-core/src/device/resource.rs:3847 — 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::compile_stage (cognitive 22) wgpu-hal/src/vulkan/device.rs:732 — Device::compile_stage has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 2, match/switch 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.
  • 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.
  • + 2 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×26
  • Duplicated block (7 lines × 2) deno_webgpu/lib.rs:396 — deno_webgpu/lib.rs:396-402 | deno_webgpu/lib.rs:439-445 — both copies are in the same file, so extract the block into 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:1309 — naga/src/back/hlsl/help.rs:1309-1315 | naga/src/back/msl/writer.rs:5054-5060 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/hlsl/help.rs:1309` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/hlsl/storage.rs:186` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) naga/src/back/hlsl/writer.rs:3713 — naga/src/back/hlsl/writer.rs:3713-3719 | naga/src/back/hlsl/writer.rs:3757-3763 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/hlsl/writer.rs:3713` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) naga/src/back/hlsl/writer.rs:4031 — naga/src/back/hlsl/writer.rs:4031-4048 | naga/src/back/hlsl/writer.rs:4058-4064 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/hlsl/writer.rs:4031` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (7 lines × 2) naga/src/back/msl/writer.rs:6592 — naga/src/back/msl/writer.rs:6592-6598 | naga/src/back/msl/writer.rs:6809-6815 — both copies are in the same file, so extract the block into 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/glsl/builtins.rs:1834 — naga/src/front/glsl/builtins.rs:1834-1840 | naga/src/front/glsl/builtins.rs:1981-1988 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/glsl/builtins.rs:1834` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (7 lines × 2) naga/src/front/spv/mod.rs:1006 — naga/src/front/spv/mod.rs:1006-1012 | naga/src/front/spv/mod.rs:1305-1311 — both copies are in the same file, so extract the block into 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:2843 — naga/src/front/spv/mod.rs:2843-2849 | naga/src/front/spv/mod.rs:2954-2960 — both copies are in the same file, so extract the block into 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:1505 — naga/src/front/wgsl/lower/mod.rs:1505-1511 | naga/src/front/wgsl/lower/mod.rs:2371-2377 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (7 lines × 2) naga/src/front/wgsl/lower/mod.rs:4763 — naga/src/front/wgsl/lower/mod.rs:4763-4769 | naga/src/front/wgsl/lower/mod.rs:4891-4897 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/wgsl/lower/mod.rs:4763` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/wgsl/parse/lexer.rs:395` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `naga/src/front/wgsl/parse/lexer.rs:403` calls `Some`, `as_str` and `naga/src/front/wgsl/parse/lexer.rs:412` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 2) wgpu-core/src/device/resource.rs:2658 — wgpu-core/src/device/resource.rs:2658-2664 | wgpu-core/src/device/resource.rs:2684-2690 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/device/resource.rs:2658` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/indirect_validation/dispatch.rs:87` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (7 lines × 2) 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 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. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/indirect_validation/dispatch.rs:274` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) wgpu-hal/src/metal/device.rs:198 — wgpu-hal/src/metal/device.rs:198-204 | wgpu-hal/src/vulkan/device.rs:816-822 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-hal/src/metal/device.rs:198` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) naga/src/back/spv/writer.rs:943 — naga/src/back/spv/writer.rs:943-949 | naga/src/back/spv/writer.rs:1175-1181 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/spv/writer.rs:943` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) naga/src/front/spv/next_block.rs:1516 — naga/src/front/spv/next_block.rs:1516-1522 | naga/src/front/spv/next_block.rs:1523-1529 — both copies are in the same file, so extract the block into 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) deno_webgpu/adapter.rs:93 — deno_webgpu/adapter.rs:93-99 | deno_webgpu/device.rs:133-139 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `deno_webgpu/device.rs:133` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • 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) naga/src/back/glsl/writer.rs:1811 — naga/src/back/glsl/writer.rs:1811-1817 | naga/src/back/hlsl/writer.rs:2277-2289 — `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 10 separate duplicated blocks between them, totalling at least 99 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/glsl/writer.rs:1811` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) naga/src/back/glsl/writer.rs:1827 — naga/src/back/glsl/writer.rs:1827-1835 | naga/src/back/msl/writer.rs:4261-4267 — `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 6 separate duplicated blocks between them, totalling at least 58 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/glsl/writer.rs:1827` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (7 lines × 2) 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:3691 — naga/src/back/hlsl/writer.rs:3691-3697 | naga/src/back/hlsl/writer.rs:3705-3711 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/hlsl/writer.rs:3691` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) naga-cli/src/bin/naga.rs:692 — naga-cli/src/bin/naga.rs:692-698 | naga-cli/src/bin/naga.rs:1051-1057 — both copies are in the same file, so extract the 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 (11 lines × 2) · ×25
  • Duplicated block (11 lines × 2) naga/src/back/glsl/writer.rs:3211 — naga/src/back/glsl/writer.rs:3211-3221 | naga/src/back/msl/writer.rs:2685-2695 — `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 6 separate duplicated blocks between them, totalling at least 58 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:1944 — naga/src/back/hlsl/writer.rs:1944-1954 | naga/src/back/wgsl/writer.rs:576-586 — `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 19 separate duplicated blocks between them, totalling at least 199 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:3770 — naga/src/back/hlsl/writer.rs:3770-3780 | naga/src/back/hlsl/writer.rs:3793-3803 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/hlsl/writer.rs:3770` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) naga/src/back/hlsl/writer.rs:4734 — naga/src/back/hlsl/writer.rs:4734-4744 | naga/src/back/wgsl/writer.rs:1939-1949 — `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 19 separate duplicated blocks between them, totalling at least 199 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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/pipeline_constants.rs:576` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) naga/src/back/spv/writer.rs:1555 — naga/src/back/spv/writer.rs:1555-1565 | naga/src/back/spv/writer.rs:3000-3011 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/spv/writer.rs:1555` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) naga/src/back/spv/writer.rs:2328 — naga/src/back/spv/writer.rs:2328-2338 | naga/src/back/spv/writer.rs:2340-2350 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/spv/writer.rs:2328` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/common/diagnostic_debug.rs:25` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/glsl/builtins.rs:269` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) 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:2946 — naga/src/proc/constant_evaluator.rs:2946-2956 | naga/src/proc/constant_evaluator.rs:3006-3016 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/proc/constant_evaluator.rs:2946` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `naga/src/proc/constant_evaluator.rs:2943` calls `Err`, `U16`, `U32` and `naga/src/proc/constant_evaluator.rs:3005` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (11 lines × 2) naga/src/proc/constant_evaluator.rs:3040 — naga/src/proc/constant_evaluator.rs:3040-3050 | naga/src/proc/constant_evaluator.rs:3085-3095 — both copies are in the same file, so extract the block into 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:1401 — naga/src/valid/interface.rs:1401-1411 | naga/src/valid/interface.rs:1451-1461 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/valid/interface.rs:1401` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (11 lines × 2) wgpu-core/src/command/render.rs:3208 — wgpu-core/src/command/render.rs:3208-3218 | wgpu-core/src/command/render.rs:3405-3415 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/command/render.rs:3208` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (11 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/track/buffer.rs:394` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-hal/src/gles/queue.rs:614` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) wgpu-hal/src/gles/wgl.rs:692 — wgpu-hal/src/gles/wgl.rs:692-702 | wgpu-hal/src/gles/wgl.rs:770-780 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-hal/src/gles/wgl.rs:692` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) wgpu-hal/src/metal/icb.rs:843 — wgpu-hal/src/metal/icb.rs:843-853 | wgpu-hal/src/metal/icb.rs:864-874 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-hal/src/metal/icb.rs:864` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) wgpu/src/backend/webgpu.rs:2185 — wgpu/src/backend/webgpu.rs:2185-2195 | wgpu/src/backend/webgpu.rs:2226-2236 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu/src/backend/webgpu.rs:2185` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `desc` to `&crate::ShaderModuleDescriptor<'_>` in one and `&crate::ShaderModuleDescriptorPassthrough<'_>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (11 lines × 2) wgpu/src/dispatch.rs:927 — wgpu/src/dispatch.rs:927-937 | wgpu/src/dispatch.rs:1079-1089 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (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 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. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/indirect_validation/dispatch.rs:110` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (11 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. Read the line range as the matched WINDOW rather than a finished unit: at `naga-cli/src/bin/naga.rs:869` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (11 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-hal/src/auxil/dxgi/dxgi_lib.rs:33` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/indirect_validation/dispatch.rs:135` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) naga/src/back/msl/writer.rs:6223 — naga/src/back/msl/writer.rs:6223-6233 | naga/src/back/msl/writer.rs:6311-6321 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/msl/writer.rs:6223` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (10 lines × 2) · ×24
  • Duplicated block (10 lines × 2) naga/src/back/glsl/writer.rs:1692 — naga/src/back/glsl/writer.rs:1692-1708 | naga/src/back/hlsl/writer.rs:2432-2441 — `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 10 separate duplicated blocks between them, totalling at least 99 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/glsl/writer.rs:1692` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) naga/src/back/msl/mod.rs:603 — naga/src/back/msl/mod.rs:603-612 | naga/src/back/msl/mod.rs:624-633 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/msl/mod.rs:603` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) naga/src/back/msl/writer.rs:6269 — naga/src/back/msl/writer.rs:6269-6278 | naga/src/back/msl/writer.rs:6493-6502 — both copies are in the same file, so extract the block into 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:921 — naga/src/back/wgsl/writer.rs:921-930 | naga/src/back/wgsl/writer.rs:950-959 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/wgsl/writer.rs:921` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `naga/src/back/wgsl/writer.rs:918` calls `to_wgsl` and `naga/src/back/wgsl/writer.rs:947` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/glsl/builtins.rs:633` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (10 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/glsl/builtins.rs:857` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/glsl/builtins.rs:868` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) naga/src/front/wgsl/lower/mod.rs:3976 — naga/src/front/wgsl/lower/mod.rs:3976-3985 | naga/src/front/wgsl/lower/mod.rs:5220-5229 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/wgsl/lower/mod.rs:3976` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (10 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/wgsl/parse/number.rs:253` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) naga/src/valid/expression.rs:1392 — naga/src/valid/expression.rs:1392-1401 | naga/src/valid/expression.rs:1435-1445 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/valid/expression.rs:1392` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) naga/src/valid/function.rs:878 — naga/src/valid/function.rs:878-887 | naga/src/valid/function.rs:993-1002 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • 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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/valid/interface.rs:457` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) wgpu-hal/src/dx12/command.rs:1038 — wgpu-hal/src/dx12/command.rs:1038-1047 | wgpu-hal/src/dx12/command.rs:1710-1719 — both copies are in the same file, so extract the block into 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/gles/device.rs:1481 — wgpu-hal/src/gles/device.rs:1481-1490 | wgpu-hal/src/metal/device.rs:1196-1205 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-hal/src/gles/device.rs:1481` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-info/src/human.rs:320` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) wgpu/src/backend/webgpu.rs:2658 — wgpu/src/backend/webgpu.rs:2658-2667 | wgpu/src/backend/webgpu.rs:4631-4640 — both copies are in the same file, so extract the block into 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:3912 — wgpu/src/backend/webgpu.rs:3912-3921 | wgpu/src/backend/webgpu.rs:4236-4245 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (10 lines × 2) naga/src/back/glsl/writer.rs:3484 — naga/src/back/glsl/writer.rs:3484-3493 | naga/src/back/glsl/writer.rs:3506-3515 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/glsl/writer.rs:3484` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `naga/src/back/glsl/writer.rs:3505` calls `write_expr`, `unwrap` and `naga/src/back/glsl/writer.rs:3483` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 2) naga/src/front/wgsl/parse/number.rs:454 — naga/src/front/wgsl/parse/number.rs:454-463 | naga/src/front/wgsl/parse/number.rs:471-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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/wgsl/parse/number.rs:454` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `naga/src/front/wgsl/parse/number.rs:469` calls `starts_with` and `naga/src/front/wgsl/parse/number.rs:451` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 2) wgpu-core/src/pipeline.rs:353 — wgpu-core/src/pipeline.rs:353-362 | wgpu/src/backend/webgpu.rs:1997-2006 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/pipeline.rs:353` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) wgpu-hal/src/auxil/dxgi/exception.rs:85 — wgpu-hal/src/auxil/dxgi/exception.rs:85-94 | wgpu-hal/src/gles/mod.rs:1135-1147 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-hal/src/auxil/dxgi/exception.rs:85` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (10 lines × 2) naga/src/back/hlsl/writer.rs:4823 — naga/src/back/hlsl/writer.rs:4823-4832 | naga/src/back/wgsl/writer.rs:1958-1969 — `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 19 separate duplicated blocks between them, totalling at least 199 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/hlsl/writer.rs:4823` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) naga/src/back/hlsl/help.rs:2311 — naga/src/back/hlsl/help.rs:2311-2320 | naga/src/back/hlsl/help.rs:2324-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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/hlsl/help.rs:2311` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (10 lines × 2) naga/src/back/glsl/writer.rs:4041 — naga/src/back/glsl/writer.rs:4041-4050 | naga/src/back/glsl/writer.rs:4091-4100 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/glsl/writer.rs:4041` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `naga/src/back/glsl/writer.rs:4090` calls `to_glsl` and `naga/src/back/glsl/writer.rs:4038` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D3 · God Classes · ClassTooLong · ×23
  • ClassTooLong: Device wgpu-core/src/device/resource.rs:237 — ClassTooLong — 3486 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 106 methods, 6 blocks, lines 237-5776. The bar is 400 significant lines; this is 3086 over it, 8.72× 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:1282 — ClassTooLong — 2795 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 41 methods, 2 blocks, lines 1282-5437. The bar is 400 significant lines; this is 2395 over it, 6.99× 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 — 1974 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-3808. The bar is 400 significant lines; this is 1574 over it, 4.94× 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 — 1776 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-3212. The bar is 400 significant lines; this is 1376 over it, 4.44× 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 — 1404 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-2188. The bar is 400 significant lines; this is 1004 over it, 3.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: 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 — 1186 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, 3 blocks, lines 28-1504. The bar is 400 significant lines; this is 786 over it, 2.97× 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:49 — ClassTooLong — 1024 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 49-2249. The bar is 400 significant lines; this is 624 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 — 1018 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-1765. The bar is 400 significant lines; this is 618 over it, 2.55× 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 — 938 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-1530. The bar is 400 significant lines; this is 538 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-4553. 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:1239 — ClassTooLong — 665 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 1239-2937. The bar is 400 significant lines; this is 265 over it, 1.66× 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 — 660 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 11 methods, 5 blocks, lines 240-1285. The bar is 400 significant lines; this is 260 over it, 1.65× 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:471 — ClassTooLong — 615 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 4 methods, 2 blocks, lines 471-2265. The bar is 400 significant lines; this is 215 over it, 1.54× 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 — 607 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-919. The bar is 400 significant lines; this is 207 over it, 1.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: CoreDevice wgpu/src/backend/wgpu_core.rs:219 — ClassTooLong — 601 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-1726. The bar is 400 significant lines; this is 201 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: 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: Buffer wgpu-core/src/resource.rs:560 — ClassTooLong — 486 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 560-1378. The bar is 400 significant lines; this is 86 over it, 1.22× 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: Texture wgpu-core/src/resource.rs:1841 — ClassTooLong — 445 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 1841-2720. The bar is 400 significant lines; this is 45 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: ResolveContext naga/src/proc/typifier.rs:220 — ClassTooLong — 436 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-817. The bar is 400 significant lines; this is 36 over it, 1.09× 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-1094. 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 (6 lines × 2) · ×23
  • Duplicated block (6 lines × 2) naga/src/back/glsl/writer.rs:3564 — naga/src/back/glsl/writer.rs:3564-3569 | naga/src/back/hlsl/writer.rs:3506-3512 — `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 10 separate duplicated blocks between them, totalling at least 99 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/glsl/writer.rs:3564` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) naga/src/back/hlsl/writer.rs:3448 — naga/src/back/hlsl/writer.rs:3448-3453 | naga/src/back/hlsl/writer.rs:3479-3486 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/hlsl/writer.rs:3479` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (6 lines × 2) naga/src/back/hlsl/writer.rs:4374 — naga/src/back/hlsl/writer.rs:4374-4379 | naga/src/back/wgsl/writer.rs:2059-2064 — `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 19 separate duplicated blocks between them, totalling at least 199 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/hlsl/writer.rs:4374` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) naga/src/back/msl/writer.rs:2022 — naga/src/back/msl/writer.rs:2022-2027 | naga/src/back/msl/writer.rs:2037-2042 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/msl/writer.rs:2022` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) naga/src/back/msl/writer.rs:7283 — naga/src/back/msl/writer.rs:7283-7288 | naga/src/back/msl/writer.rs:8533-8540 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/msl/writer.rs:7283` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) naga/src/front/spv/image.rs:289 — naga/src/front/spv/image.rs:289-294 | naga/src/front/spv/image.rs:419-424 — both copies are in the same file, so extract the block into 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:3425 — naga/src/front/wgsl/lower/mod.rs:3425-3430 | naga/src/front/wgsl/lower/mod.rs:3566-3571 — both copies are in the same file, so extract the block into 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:723 — naga/src/valid/analyzer.rs:723-728 | naga/src/valid/analyzer.rs:749-754 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/valid/analyzer.rs:723` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `naga/src/valid/analyzer.rs:729` calls `add_ref` and `naga/src/valid/analyzer.rs:755` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 2) wgpu-core/src/binding_model.rs:1801 — wgpu-core/src/binding_model.rs:1801-1806 | wgpu-core/src/resource.rs:2848-2854 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/binding_model.rs:1801` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) wgpu-core/src/pipeline.rs:686 — wgpu-core/src/pipeline.rs:686-691 | wgpu-core/src/pipeline.rs:1336-1341 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/pipeline.rs:686` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (6 lines × 2) wgpu-hal/src/vulkan/device.rs:2850 — wgpu-hal/src/vulkan/device.rs:2850-2856 | wgpu-hal/src/vulkan/device.rs:2919-2924 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-hal/src/vulkan/device.rs:2850` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-hal/src/vulkan/instance.rs:130` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) naga/src/front/wgsl/parse/mod.rs:935 — naga/src/front/wgsl/parse/mod.rs:935-940 | naga/src/front/wgsl/parse/mod.rs:942-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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (6 lines × 2) wgpu-hal/src/dx12/mod.rs:1042 — wgpu-hal/src/dx12/mod.rs:1042-1047 | wgpu-hal/src/lib.rs:2383-2388 — 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:982-988 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-hal/src/gles/device.rs:1360` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `deno_webgpu/compute_pass.rs:202` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) wgpu/src/api/command_buffer.rs:41 — wgpu/src/api/command_buffer.rs:41-46 | wgpu/src/api/command_encoder.rs:479-484 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/wgsl/parse/mod.rs:186` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (6 lines × 2) naga/src/back/glsl/writer.rs:3389 — naga/src/back/glsl/writer.rs:3389-3394 | naga/src/back/glsl/writer.rs:3420-3425 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/glsl/writer.rs:3389` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `deno_webgpu/byow.rs:245` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (6 lines × 2) naga/src/back/msl/writer.rs:2500 — naga/src/back/msl/writer.rs:2500-2505 | naga/src/back/msl/writer.rs:2509-2514 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/msl/writer.rs:2500` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) naga/src/back/wgsl/writer.rs:932 — naga/src/back/wgsl/writer.rs:932-937 | naga/src/back/wgsl/writer.rs:1097-1102 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
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 — 120 methods, declared across 2 files: spv/instructions.rs (113), spv/layout.rs (7). The bar is 30 methods; this is 90 over it, 4.00× 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:763 — TooManyMethods — 109 methods, declared across 6 files: hlsl/writer.rs (45), hlsl/help.rs (36), hlsl/ray.rs (11), hlsl/immediates.rs (6), +2 more file(s). 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:237 — TooManyMethods — 106 methods, declared across 4 files: device/resource.rs (89), src/error.rs (8), device/ray_tracing.rs (7), src/as_hal.rs (2). The bar is 30 methods; this is 76 over it, 3.53× 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:929 — TooManyMethods — 105 methods, declared across 7 files: spv/writer.rs (77), spv/mesh_shader.rs (8), ray/query.rs (7), ray/hit_object.rs (5), +3 more file(s). The bar is 30 methods; this is 75 over it, 3.50× 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:548 — TooManyMethods — 73 methods. The bar is 30 methods; this is 43 over it, 2.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: 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:834 — TooManyMethods — 60 methods, declared across 8 files: spv/block.rs (23), spv/image.rs (12), spv/index.rs (9), spv/mod.rs (8), +4 more file(s). The bar is 30 methods; this is 30 over it, 2.00× 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 — 50 methods, declared across 5 files: glsl/writer.rs (39), msl/ray.rs (5), glsl/features.rs (3), msl/mesh_shader.rs (2), +1 more file(s). The bar is 30 methods; this is 20 over it, 1.67× 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: Validator naga/src/valid/mod.rs:388 — TooManyMethods — 49 methods, declared across 6 files: valid/function.rs (15), valid/handles.rs (12), valid/mod.rs (9), valid/expression.rs (6), +2 more file(s). The bar is 30 methods; this is 19 over it, 1.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/src/api/device.rs:23 — TooManyMethods — 48 methods. The bar is 30 methods; this is 18 over it, 1.60× 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: CommandEncoder wgpu-core/src/command/mod.rs:520 — TooManyMethods — 45 methods, declared across 10 files: command/mod.rs (16), command/transfer.rs (8), command/clear.rs (4), command/query.rs (4), +6 more file(s). The bar is 30 methods; this is 15 over it, 1.50× 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: 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: Player player/src/lib.rs:28 — 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: Lowerer naga/src/front/wgsl/lower/mod.rs:1282 — TooManyMethods — 41 methods, declared across 2 files: lower/mod.rs (40), lower/construction.rs (1). The bar is 30 methods; this is 11 over it, 1.37× 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: ExpressionContext naga/src/front/wgsl/lower/mod.rs:371 — 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:853 — 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 (8 lines × 2) · ×22
  • 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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/dot/mod.rs:221` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (8 lines × 2) naga/src/back/hlsl/help.rs:436 — naga/src/back/hlsl/help.rs:436-443 | naga/src/back/hlsl/help.rs:563-570 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/hlsl/help.rs:436` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `self` to `super) fn write_wrapped_image_load_function( &mut` in one and `super) fn write_wrapped_image_sample_function( &mut` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (8 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/spv/block.rs:1724` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) naga/src/front/glsl/builtins.rs:1982 — naga/src/front/glsl/builtins.rs:1982-1989 | naga/src/front/glsl/builtins.rs:2005-2012 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/glsl/builtins.rs:1982` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) naga/src/front/spv/mod.rs:2250 — naga/src/front/spv/mod.rs:2250-2257 | naga/src/front/spv/mod.rs:2305-2312 — both copies are in the same file, so extract the block into 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: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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/wgsl/error.rs:120` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) naga/src/front/wgsl/lower/mod.rs:3780 — naga/src/front/wgsl/lower/mod.rs:3780-3787 | naga/src/front/wgsl/lower/mod.rs:3794-3801 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/wgsl/lower/mod.rs:3780` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (8 lines × 2) wgpu-core/src/command/ray_tracing.rs:870 — wgpu-core/src/command/ray_tracing.rs:870-877 | wgpu-core/src/command/ray_tracing.rs:957-964 — both copies are in the same file, so extract the block into 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:1040 — wgpu-core/src/command/ray_tracing.rs:1040-1047 | wgpu-core/src/command/ray_tracing.rs:1169-1176 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/command/ray_tracing.rs:1040` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) wgpu-core/src/resource.rs:878 — wgpu-core/src/resource.rs:878-885 | wgpu-core/src/resource.rs:3733-3740 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) 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:2367 — wgpu-hal/src/vulkan/device.rs:2367-2374 | wgpu-hal/src/vulkan/device.rs:2450-2457 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-hal/src/vulkan/device.rs:2367` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) wgpu/src/backend/webgpu.rs:1084 — wgpu/src/backend/webgpu.rs:1084-1091 | wgpu/src/backend/webgpu.rs:1092-1099 — both copies are in the same file, so extract the block into 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/writer.rs:4080 — naga/src/back/hlsl/writer.rs:4080-4087 | naga/src/back/wgsl/writer.rs:1609-1616 — `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 19 separate duplicated blocks between them, totalling at least 199 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/hlsl/writer.rs:4080` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) naga/src/back/msl/writer.rs:2949 — naga/src/back/msl/writer.rs:2949-2956 | naga/src/back/msl/writer.rs:2968-2975 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/msl/writer.rs:2949` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu/src/api/pipeline_cache.rs:78` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) wgpu-core/src/pipeline.rs:381 — wgpu-core/src/pipeline.rs:381-388 | wgpu/src/backend/webgpu.rs:2028-2035 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Note first that the copies are not typed on the same thing: the declarations holding them bind `value` to `&naga::SourceLocation` in one and `crate::naga::SourceLocation` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (8 lines × 2) 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `buffer_slice` to `BufferSlice<'a>` in one and `BufferSlice<'_>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (8 lines × 2) naga/src/back/hlsl/help.rs:436 — naga/src/back/hlsl/help.rs:436-443 | naga/src/back/msl/writer.rs:6775-6783 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/hlsl/help.rs:436` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (8 lines × 2) naga/src/back/msl/writer.rs:1435 — naga/src/back/msl/writer.rs:1435-1442 | naga/src/back/msl/writer.rs:3202-3209 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/msl/writer.rs:1435` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/hlsl/storage.rs:198` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D1 · Cyclomatic Complexity · Device · ×21
  • Device::create_render_pipeline_or_error_inner (cyclomatic 105) wgpu-core/src/device/resource.rs:4737 — Device::create_render_pipeline_or_error_inner has cyclomatic complexity 105 (threshold 15). To reduce it, separate the cases: extract each independent 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 50) wgpu-hal/src/metal/device.rs:1517 — Device::create_render_pipeline 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.
  • Device::validate_texture_descriptor_inner (cyclomatic 49) wgpu-core/src/device/resource.rs:1827 — Device::validate_texture_descriptor_inner 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.
  • 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:3093 — 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::create_buffer_inner (cyclomatic 27) wgpu-core/src/device/resource.rs:1235 — 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::texture_use_parameters (cyclomatic 27) wgpu-core/src/device/resource.rs:4150 — Device::texture_use_parameters 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.
  • Device::load_shader (cyclomatic 27) wgpu-hal/src/metal/device.rs:187 — Device::load_shader has cyclomatic complexity 27 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. 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/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:994 — 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:2108 — 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_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:1181 — 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:3847 — 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::create_ray_tracing_pipeline_inner (cyclomatic 19) wgpu-core/src/device/ray_tracing.rs:392 — Device::create_ray_tracing_pipeline_inner 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.
  • Device::maintain (cyclomatic 18) wgpu-core/src/device/resource.rs:1021 — 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:1489 — 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.
  • Device::create_texture_view (cyclomatic 17) wgpu-hal/src/metal/device.rs:694 — Device::create_texture_view has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: 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.
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::compact::compact (cognitive 81) naga/src/compact/mod.rs:68 — naga::compact::compact has cognitive complexity 81 (threshold 15). Drivers by points: if/else 37 (63 pts), loops 10 (15 pts), boolean chains 3 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • 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::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:618 — 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::adjust_stmt (cognitive 33) naga/src/back/pipeline_constants.rs:746 — naga::back::pipeline_constants::adjust_stmt has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (16 pts), match/switch 6 (11 pts), loops 3 (6 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::back::pipeline_constants::map_value_to_literal (cognitive 32) naga/src/back/pipeline_constants.rs:1097 — 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::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:1024 — 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.
D4 · Code Duplication · Duplicated block (12 lines × 2) · ×20
  • Duplicated block (12 lines × 2) deno_webgpu/buffer.rs:263 — deno_webgpu/buffer.rs:263-274 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `deno_webgpu/buffer.rs:263` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) naga/src/back/glsl/writer.rs:2489 — naga/src/back/glsl/writer.rs:2489-2500 | naga/src/back/wgsl/writer.rs:1631-1642 — `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 10 separate duplicated blocks between them, totalling at least 141 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/glsl/writer.rs:2489` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) naga/src/back/hlsl/writer.rs:440 — naga/src/back/hlsl/writer.rs:440-451 | naga/src/back/wgsl/writer.rs:162-173 — `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 19 separate duplicated blocks between them, totalling at least 199 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `naga/src/back/hlsl/writer.rs:434` calls `write_special_functions`, `write_wrapped_expression_functions`, `write_wrapped_zero_value_functions` and `naga/src/back/wgsl/writer.rs:159` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12 lines × 2) naga/src/back/wgsl/writer.rs:1685 — naga/src/back/wgsl/writer.rs:1685-1696 | naga/src/back/wgsl/writer.rs:1759-1770 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/wgsl/writer.rs:1685` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (12 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/glsl/builtins.rs:1305` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) naga/src/front/glsl/functions.rs:1074 — naga/src/front/glsl/functions.rs:1074-1085 | naga/src/front/glsl/functions.rs:1156-1167 — both copies are in the same file, so extract the block into 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:1731 — naga/src/front/wgsl/lower/mod.rs:1731-1742 | naga/src/front/wgsl/lower/mod.rs:1746-1757 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/wgsl/lower/mod.rs:1731` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (12 lines × 2) naga/src/proc/constant_evaluator.rs:2918 — naga/src/proc/constant_evaluator.rs:2918-2929 | naga/src/proc/constant_evaluator.rs:2981-2992 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/proc/constant_evaluator.rs:2918` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) naga/src/proc/constant_evaluator.rs:2931 — naga/src/proc/constant_evaluator.rs:2931-2942 | naga/src/proc/constant_evaluator.rs:2994-3005 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `naga/src/proc/constant_evaluator.rs:2943` calls `Err`, `U16`, `U32` and `naga/src/proc/constant_evaluator.rs:3006` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12 lines × 2) naga/src/valid/function.rs:735 — naga/src/valid/function.rs:735-746 | naga/src/valid/function.rs:798-809 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/valid/function.rs:735` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) player/src/lib.rs:1135 — player/src/lib.rs:1135-1146 | player/src/lib.rs:1290-1301 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `player/src/lib.rs:1135` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) wgpu-core/src/device/resource.rs:547 — wgpu-core/src/device/resource.rs:547-558 | wgpu-core/src/device/resource.rs:566-577 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/device/resource.rs:566` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/indirect_validation/dispatch.rs:150` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/track/texture.rs:1231` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (12 lines × 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (12 lines × 2) wgpu/src/api/command_encoder.rs:458 — wgpu/src/api/command_encoder.rs:458-469 | 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (12 lines × 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit. Note first that the copies are not typed on the same thing: the declarations holding them bind `buffer_slice` to `BufferSlice<'a>` in one and `BufferSlice<'_>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (12 lines × 2) naga/src/back/hlsl/writer.rs:2538 — naga/src/back/hlsl/writer.rs:2538-2549 | naga/src/back/hlsl/writer.rs:5013-5024 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/hlsl/writer.rs:2538` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) wgpu-core/src/command/query.rs:209 — wgpu-core/src/command/query.rs:209-220 | wgpu-core/src/present.rs:134-151 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×20
  • Duplicated block (9 lines × 2) naga/src/back/glsl/writer.rs:2288 — naga/src/back/glsl/writer.rs:2288-2296 | naga/src/back/wgsl/writer.rs:1209-1217 — `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 10 separate duplicated blocks between them, totalling at least 141 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/glsl/writer.rs:2288` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) naga/src/back/hlsl/writer.rs:2425 — naga/src/back/hlsl/writer.rs:2425-2433 | naga/src/back/wgsl/writer.rs:961-969 — `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 19 separate duplicated blocks between them, totalling at least 199 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:3881 — naga/src/back/hlsl/writer.rs:3881-3889 | naga/src/back/wgsl/writer.rs:1519-1527 — `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 19 separate duplicated blocks between them, totalling at least 199 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/hlsl/writer.rs:3881` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) naga/src/front/wgsl/lower/construction.rs:529 — naga/src/front/wgsl/lower/construction.rs:529-538 | naga/src/front/wgsl/lower/mod.rs:2924-2932 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/wgsl/lower/construction.rs:529` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/wgsl/parse/mod.rs:917` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) naga/src/valid/analyzer.rs:743 — naga/src/valid/analyzer.rs:743-751 | naga/src/valid/analyzer.rs:802-810 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/valid/analyzer.rs:743` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (9 lines × 2) wgpu-core/src/command/compute.rs:287 — wgpu-core/src/command/compute.rs:287-295 | wgpu-core/src/command/ray_tracing_pass.rs:340-348 — before extracting anything, compare `wgpu-core/src/command/compute.rs` and `wgpu-core/src/command/ray_tracing_pass.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 180 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/command/compute.rs:287` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) wgpu-core/src/command/transfer.rs:916 — wgpu-core/src/command/transfer.rs:916-924 | wgpu-core/src/command/transfer.rs:967-975 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/command/transfer.rs:916` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) wgpu-core/src/device/resource.rs:4614 — wgpu-core/src/device/resource.rs:4614-4622 | wgpu-core/src/device/resource.rs:5238-5246 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/device/resource.rs:4614` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `desc` to `&crate::RenderPassDescriptor<super::QuerySet, super::TextureView>` in one and `&crate::ComputePassDescriptor<super::QuerySet>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wgpu-hal/src/gles/command.rs:513` calls `clear` and `wgpu-hal/src/gles/command.rs:1234` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-hal/src/gles/device.rs:144` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) wgpu-hal/src/metal/command.rs:703 — wgpu-hal/src/metal/command.rs:703-711 | wgpu-hal/src/metal/command.rs:748-756 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-hal/src/metal/command.rs:703` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) wgpu-core/src/command/mod.rs:764 — wgpu-core/src/command/mod.rs:764-772 | wgpu-core/src/command/mod.rs:778-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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit. Note first that the copies are not typed on the same thing: the declarations holding them bind `self` to `&mut` in one and `crate) fn open(&mut` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (9 lines × 2) naga/src/front/spv/next_block.rs:2434 — naga/src/front/spv/next_block.rs:2434-2442 | naga/src/front/spv/next_block.rs:2474-2482 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `naga/src/front/spv/next_block.rs:2433` calls `next` and `naga/src/front/spv/next_block.rs:2473` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9 lines × 2) naga/src/front/wgsl/parse/mod.rs:1652 — naga/src/front/wgsl/parse/mod.rs:1652-1660 | naga/src/front/wgsl/parse/mod.rs:1885-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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/wgsl/parse/mod.rs:1652` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) wgpu-hal/src/gles/device.rs:1688 — wgpu-hal/src/gles/device.rs:1688-1696 | wgpu-hal/src/gles/device.rs:1724-1732 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `pipeline` to `super::RenderPipeline` in one and `super::ComputePipeline` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (9 lines × 2) naga/src/front/spv/next_block.rs:469 — naga/src/front/spv/next_block.rs:469-477 | naga/src/front/spv/next_block.rs:548-556 — both copies are in the same file, so extract the block into 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:1585 — naga/src/back/hlsl/help.rs:1585-1594 | naga/src/back/hlsl/help.rs:1636-1644 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/hlsl/help.rs:1585` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (9 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/wgsl/parse/mod.rs:1941` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `naga/src/front/wgsl/parse/mod.rs:1938` calls `set` and `naga/src/front/wgsl/parse/mod.rs:1981` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9 lines × 2) naga/src/proc/namer.rs:365 — naga/src/proc/namer.rs:365-373 | naga/src/proc/namer.rs:380-388 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
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::wgsl::parse::conv::map_predeclared_type (cyclomatic 93) naga/src/front/wgsl/parse/conv.rs:449 — naga::front::wgsl::parse::conv::map_predeclared_type has cyclomatic complexity 93 (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::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 64) naga/src/back/dot/mod.rs:618 — naga::back::dot::write_function_expressions has cyclomatic complexity 64 (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::back::pipeline_constants::adjust_stmt (cyclomatic 46) naga/src/back/pipeline_constants.rs:746 — naga::back::pipeline_constants::adjust_stmt has cyclomatic complexity 46 (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 46) naga/src/compact/mod.rs:68 — naga::compact::compact 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.
  • 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::common::wgsl::types::try_write_type_inner (cyclomatic 39) naga/src/common/wgsl/types.rs:194 — naga::common::wgsl::types::try_write_type_inner has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • 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::back::pipeline_constants::adjust_expr (cyclomatic 38) naga/src/back/pipeline_constants.rs:488 — naga::back::pipeline_constants::adjust_expr has cyclomatic complexity 38 (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:1097 — 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 349) naga/src/front/spv/next_block.rs:22 — Frontend::next_block has cognitive complexity 349 (threshold 15). Drivers by points: if/else 71 (167 pts), match/switch 36 (123 pts), loops 18 (56 pts), boolean chains 3 (nesting depth added 221). Of this number, 348 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:513 — 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:489 — 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:2941 — 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:1704 — 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:209 — 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:412 — 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:871 — 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:1573 — 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:1944 — 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:365 — 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.
D2 · Cognitive Complexity · CommandEncoder · ×17
  • 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:925 — 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:1031 — 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:91 — 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:641 — 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:1320 — 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:312 — 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 19) wgpu-core/src/command/mod.rs:1095 — CommandEncoder::encode_commands has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 5 (12 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:272 — 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::defer_multi_draw_via_icb (cognitive 18) wgpu-hal/src/metal/icb.rs:626 — CommandEncoder::defer_multi_draw_via_icb has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (11 pts), match/switch 5 (7 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CommandEncoder::encode_deferred_icb_generation (cognitive 18) wgpu-hal/src/metal/icb.rs:790 — CommandEncoder::encode_deferred_icb_generation has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), match/switch 2 (4 pts), loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CommandEncoder::set_immediates (cognitive 17) wgpu-hal/src/metal/command.rs:1231 — 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.
D4 · Code Duplication · Duplicated block (13 lines × 2) · ×16
  • 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. Read the line range as the matched WINDOW rather than a finished unit: at `deno_webgpu/webidl.rs:54` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) naga/src/back/hlsl/help.rs:2355 — naga/src/back/hlsl/help.rs:2355-2367 | naga/src/back/hlsl/help.rs:2373-2385 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/hlsl/help.rs:2355` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/hlsl/storage.rs:357` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) naga/src/back/hlsl/writer.rs:3520 — naga/src/back/hlsl/writer.rs:3520-3532 | naga/src/back/msl/writer.rs:1951-1963 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/hlsl/writer.rs:3520` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (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. Note first that the copies are not typed on the same thing: the declarations holding them bind `self` to `super) fn write_mesh_shader_wrapper( &mut` in one and `super) fn write_task_shader_wrapper( &mut` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `naga/src/back/spv/mesh_shader.rs:782` calls `get_u32_type_id` and `naga/src/back/spv/mesh_shader.rs:854` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (13 lines × 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (13 lines × 2) naga/src/front/wgsl/lower/mod.rs:3545 — naga/src/front/wgsl/lower/mod.rs:3545-3557 | naga/src/front/wgsl/lower/mod.rs:3584-3596 — both copies are in the same file, so extract the block into 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:3242 — wgpu-core/src/command/render.rs:3242-3254 | wgpu-core/src/command/render.rs:3462-3474 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/command/render.rs:3242` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (13 lines × 2) wgpu-core/src/device/resource.rs:1381 — wgpu-core/src/device/resource.rs:1381-1393 | wgpu-core/src/device/resource.rs:1753-1765 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/device/resource.rs:1381` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) wgpu-core/src/device/resource.rs:4629 — wgpu-core/src/device/resource.rs:4629-4641 | wgpu-core/src/device/resource.rs:5312-5324 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wgpu-core/src/device/resource.rs:5326` calls `is_some` and `wgpu-core/src/device/resource.rs:4643` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (13 lines × 2) wgpu-core/src/pipeline.rs:316 — wgpu-core/src/pipeline.rs:316-328 | wgpu-core/src/pipeline.rs:367-379 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/track/texture.rs:1521` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wgpu-core/src/track/texture.rs:1587` calls `coalesce` and `wgpu-core/src/track/texture.rs:1534` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (13 lines × 2) wgpu-hal/src/metal/command.rs:1359 — wgpu-hal/src/metal/command.rs:1359-1371 | wgpu-hal/src/metal/command.rs:1475-1487 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-hal/src/metal/command.rs:1359` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) wgpu-hal/src/vulkan/device.rs:2488 — wgpu-hal/src/vulkan/device.rs:2488-2500 | wgpu-hal/src/vulkan/device.rs:2505-2517 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-hal/src/vulkan/device.rs:2488` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (13 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. Read the line range as the matched WINDOW rather than a finished unit: at `naga-cli/src/bin/naga.rs:949` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (13 lines × 2) naga/src/back/dot/mod.rs:419 — naga/src/back/dot/mod.rs:419-431 | naga/src/back/dot/mod.rs:445-457 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/dot/mod.rs:419` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (5 lines × 2) · ×16
  • Duplicated block (5 lines × 2) naga/src/back/glsl/writer.rs:761 — naga/src/back/glsl/writer.rs:761-766 | naga/src/back/glsl/writer.rs:829-833 — both copies are in the same file, so extract the block into 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:1787 — naga/src/back/glsl/writer.rs:1787-1791 | naga/src/back/hlsl/writer.rs:2355-2359 — `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 10 separate duplicated blocks between them, totalling at least 99 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/glsl/writer.rs:1787` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) naga/src/back/glsl/writer.rs:1867 — naga/src/back/glsl/writer.rs:1867-1871 | naga/src/back/hlsl/writer.rs:2812-2816 — `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 10 separate duplicated blocks between them, totalling at least 99 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/glsl/writer.rs:1867` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `naga/src/back/glsl/writer.rs:1872` calls `next` and `naga/src/back/hlsl/writer.rs:2817` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 2) naga/src/back/msl/writer.rs:1706 — naga/src/back/msl/writer.rs:1706-1710 | naga/src/back/msl/writer.rs:1730-1734 — both copies are in the same file, so extract the block into 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (5 lines × 2) naga/src/proc/constant_evaluator.rs:3271 — naga/src/proc/constant_evaluator.rs:3271-3275 | naga/src/proc/constant_evaluator.rs:3342-3346 — both copies are in the same file, so extract the block into 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:613 — wgpu-core/src/pipeline.rs:613-617 | wgpu-core/src/pipeline.rs:1247-1251 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/pipeline.rs:613` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) naga/src/back/hlsl/writer.rs:3823 — naga/src/back/hlsl/writer.rs:3823-3827 | naga/src/back/wgsl/writer.rs:1464-1468 — `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 19 separate duplicated blocks between them, totalling at least 199 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/hlsl/writer.rs:3823` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) wgpu/src/api/compute_pass.rs:60 — wgpu/src/api/compute_pass.rs:60-64 | wgpu/src/api/ray_tracing_pass.rs:61-65 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wgpu/src/api/compute_pass.rs:67` calls `set_pipeline` and `wgpu/src/api/ray_tracing_pass.rs:68` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 2) 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:3723 — naga/src/back/hlsl/writer.rs:3723-3730 | naga/src/back/hlsl/writer.rs:3740-3744 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/hlsl/writer.rs:3723` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (5 lines × 2) naga/src/back/msl/writer.rs:4371 — naga/src/back/msl/writer.rs:4371-4376 | naga/src/back/wgsl/writer.rs:877-881 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/msl/writer.rs:4371` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) naga/src/back/hlsl/help.rs:1485 — naga/src/back/hlsl/help.rs:1485-1489 | naga/src/back/hlsl/help.rs:1537-1541 — both copies are in the same file, so extract the block into 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/resource.rs:2042 — wgpu-core/src/resource.rs:2042-2046 | wgpu-core/src/resource.rs:3136-3140 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/resource.rs:2042` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) naga/src/back/hlsl/writer.rs:2855 — naga/src/back/hlsl/writer.rs:2855-2859 | naga/src/back/wgsl/writer.rs:849-853 — `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 19 separate duplicated blocks between them, totalling at least 199 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/hlsl/writer.rs:2855` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) naga/src/back/glsl/writer.rs:3160 — naga/src/back/glsl/writer.rs:3160-3164 | naga/src/back/glsl/writer.rs:3503-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.
D1 · Cyclomatic Complexity · Frontend · ×13
  • Frontend::next_block (cyclomatic 290) naga/src/front/spv/next_block.rs:22 — Frontend::next_block has cyclomatic complexity 290 (threshold 15). Of this number, 288 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:1704 — 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:489 — 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:513 — 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:2941 — 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:1573 — 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.
D17 · Explicit Debt · HackComment · ×13
  • HackComment wgpu-core/src/instance.rs:695 — // 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:755 — // 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:2391 — // 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:2472 — // 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:1976 — // 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:2000 — // 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:2029 — // 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:3793 — // 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:4055 — // 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:3759 — // 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 · Edited copy of a member (9 corresponding lines) · ×12
  • Edited copy of a member (9 corresponding lines) naga/src/front/spv/mod.rs:2087 — naga/src/front/spv/mod.rs:2087-2095 | naga/src/front/spv/mod.rs:2097-2110 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) naga/src/front/glsl/error.rs:176 — naga/src/front/glsl/error.rs:176-186 | naga/src/front/spv/error.rs:166-174 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) wgpu-core/src/device/queue.rs:715 — wgpu-core/src/device/queue.rs:715-723 | wgpu-core/src/ray_tracing.rs:521-530 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) wgpu-core/src/command/query.rs:360 — wgpu-core/src/command/query.rs:360-368 | wgpu-core/src/command/query.rs:418-426 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) wgpu-core/src/device/resource.rs:4577 — wgpu-core/src/device/resource.rs:4577-4585 | wgpu-core/src/device/resource.rs:4727-4735 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) naga/src/proc/type_methods.rs:149 — naga/src/proc/type_methods.rs:149-157 | naga/src/proc/type_methods.rs:182-191 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) naga/src/front/wgsl/lower/template_list.rs:120 — naga/src/front/wgsl/lower/template_list.rs:120-131 | naga/src/front/wgsl/lower/template_list.rs:182-190 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) wgpu-core/src/command/compute.rs:1439 — wgpu-core/src/command/compute.rs:1439-1447 | wgpu-core/src/command/render.rs:4498-4506 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) wgpu-core/src/command/bundle.rs:936 — wgpu-core/src/command/bundle.rs:936-944 | wgpu-core/src/command/mod.rs:1817-1825 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) wgpu-core/src/command/compute.rs:1457 — wgpu-core/src/command/compute.rs:1457-1465 | wgpu-core/src/command/render.rs:4518-4526 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) wgpu/src/backend/webgpu.rs:3964 — wgpu/src/backend/webgpu.rs:3964-3973 | wgpu/src/backend/wgpu_core.rs:2648-2656 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) wgpu/src/backend/webgpu.rs:4273 — wgpu/src/backend/webgpu.rs:4273-4282 | wgpu/src/backend/wgpu_core.rs:2984-2992 — These two members are one piece of code written twice and then edited apart: 9 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.
D1 · Cyclomatic Complexity · CommandEncoder · ×11
  • 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:312 — 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:925 — 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 25) wgpu-core/src/command/mod.rs:1095 — CommandEncoder::encode_commands has cyclomatic complexity 25 (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:1031 — 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:272 — 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:91 — 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:1320 — 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.
  • CommandEncoder::defer_multi_draw_via_icb (cyclomatic 16) wgpu-hal/src/metal/icb.rs:626 — CommandEncoder::defer_multi_draw_via_icb 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.
D2 · Cognitive Complexity · Validator · ×11
  • Validator::validate_block_impl (cognitive 355) naga/src/valid/function.rs:812 — Validator::validate_block_impl has cognitive complexity 355 (threshold 15). Drivers by points: if/else 57 (189 pts), match/switch 37 (133 pts), loops 10 (31 pts), boolean chains 2 (nesting depth added 249). To reduce it, split the body into named stages: move each independent 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 304) naga/src/valid/expression.rs:386 — Validator::validate_expression has cognitive complexity 304 (threshold 15). Drivers by points: match/switch 72 (179 pts), if/else 50 (108 pts), boolean chains 11, loops 3 (6 pts) (nesting depth added 168). Of this number, 302 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 159) naga/src/valid/type.rs:383 — Validator::validate_type has cognitive complexity 159 (threshold 15). Drivers by points: if/else 48 (119 pts), match/switch 12 (28 pts), boolean chains 10, 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:1267 — 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 73) naga/src/valid/interface.rs:920 — Validator::validate_global_var has cognitive complexity 73 (threshold 15). Drivers by points: if/else 25 (52 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:447 — 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 35) naga/src/valid/function.rs:2131 — Validator::validate_function has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (24 pts), match/switch 2 (5 pts), boolean chains 3, loops 3 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • 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 21) naga/src/valid/handles.rs:694 — Validator::validate_block_handles has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 6 (11 pts), loops 3 (6 pts), if/else 3 (4 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.
  • Validator::validate_impl (cognitive 18) naga/src/valid/mod.rs:775 — 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 · Edited copy of a member (11 corresponding lines) · ×11
  • Edited copy of a member (11 corresponding lines) naga/src/front/spv/mod.rs:2047 — naga/src/front/spv/mod.rs:2047-2057 | naga/src/front/spv/mod.rs:2059-2074 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) wgpu/src/api/buffer.rs:678 — wgpu/src/api/buffer.rs:678-688 | wgpu/src/api/buffer.rs:709-719 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) naga/src/back/hlsl/writer.rs:5194 — naga/src/back/hlsl/writer.rs:5194-5204 | naga/src/back/msl/writer.rs:646-657 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) wgpu-hal/src/dx12/command.rs:1625 — wgpu-hal/src/dx12/command.rs:1625-1635 | wgpu-hal/src/dx12/command.rs:1683-1700 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) wgpu-core/src/command/bundle.rs:1446 — wgpu-core/src/command/bundle.rs:1446-1456 | wgpu-core/src/resource.rs:3112-3123 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) wgpu-core/src/command/transfer.rs:384 — wgpu-core/src/command/transfer.rs:384-394 | wgpu-core/src/command/transfer.rs:407-419 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) deno_webgpu/buffer.rs:56 — deno_webgpu/buffer.rs:56-66 | wgpu-core-remote/src/lib.rs:42-53 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) wgpu-core/src/command/clear.rs:122 — wgpu-core/src/command/clear.rs:122-132 | wgpu-core/src/command/clear.rs:150-163 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) naga/src/back/spv/instructions.rs:956 — naga/src/back/spv/instructions.rs:956-966 | naga/src/back/spv/instructions.rs:981-991 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) wgpu-core/src/command/compute.rs:1316 — wgpu-core/src/command/compute.rs:1316-1326 | wgpu-core/src/command/render.rs:3700-3714 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) wgpu-sync/src/mutex.rs:32 — wgpu-sync/src/mutex.rs:32-42 | wgpu-sync/src/rwlock.rs:39-49 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · 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:5063-5077 — `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 6 separate duplicated blocks between them, totalling at least 58 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/glsl/writer.rs:244` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (15 lines × 2) naga/src/back/glsl/writer.rs:2501 — naga/src/back/glsl/writer.rs:2501-2515 | naga/src/back/wgsl/writer.rs:1644-1658 — `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 10 separate duplicated blocks between them, totalling at least 141 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/glsl/writer.rs:2501` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) naga/src/back/hlsl/help.rs:1196 — naga/src/back/hlsl/help.rs:1196-1210 | naga/src/back/hlsl/help.rs:1273-1287 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/hlsl/help.rs:1196` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `self` to `super) fn write_wrapped_struct_matrix_set_vec_function( &mut` in one and `super) fn write_wrapped_struct_matrix_set_scalar_function( &mut` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (15 lines × 2) naga/src/back/hlsl/help.rs:1702 — naga/src/back/hlsl/help.rs:1702-1716 | naga/src/back/hlsl/help.rs:1767-1781 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/hlsl/help.rs:1702` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) naga/src/back/hlsl/writer.rs:3129 — naga/src/back/hlsl/writer.rs:3129-3143 | naga/src/back/hlsl/writer.rs:3193-3207 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/hlsl/writer.rs:3129` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (15 lines × 2) naga/src/back/spv/ray/mod.rs:170 — naga/src/back/spv/ray/mod.rs:170-184 | naga/src/back/spv/ray/mod.rs:218-232 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/spv/ray/mod.rs:170` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/glsl/builtins.rs:666` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/glsl/builtins.rs:1448` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) naga/src/valid/expression.rs:811 — naga/src/valid/expression.rs:811-825 | naga/src/valid/expression.rs:826-840 — both copies are in the same file, so extract the block into 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-core/src/command/transfer.rs:1252 — wgpu-core/src/command/transfer.rs:1252-1266 | wgpu-core/src/command/transfer.rs:1370-1384 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/command/transfer.rs:1252` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) wgpu/src/backend/webgpu.rs:3889 — wgpu/src/backend/webgpu.rs:3889-3903 | wgpu/src/backend/webgpu.rs:4213-4227 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D1 · Cyclomatic Complexity · Validator · ×10
  • Validator::validate_expression (cyclomatic 219) naga/src/valid/expression.rs:386 — Validator::validate_expression has cyclomatic complexity 219 (threshold 15). Of this number, 213 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 149) naga/src/valid/function.rs:812 — Validator::validate_block_impl has cyclomatic complexity 149 (threshold 15). To reduce it, separate the cases: extract each independent 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 86) naga/src/valid/type.rs:383 — Validator::validate_type has cyclomatic complexity 86 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Validator::validate_entry_point (cyclomatic 79) naga/src/valid/interface.rs:1267 — 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 52) naga/src/valid/interface.rs:920 — Validator::validate_global_var has cyclomatic complexity 52 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Validator::validate_block_handles (cyclomatic 41) naga/src/valid/handles.rs:694 — Validator::validate_block_handles 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.
  • 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_atomic (cyclomatic 25) naga/src/valid/function.rs:447 — 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 21) naga/src/valid/function.rs:2131 — Validator::validate_function has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • 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.
D4 · Code Duplication · Edited copy of a member (8 corresponding lines) · ×10
  • Edited copy of a member (8 corresponding lines) naga-cli/src/bin/naga.rs:172 — naga-cli/src/bin/naga.rs:172-182 | naga-cli/src/bin/naga.rs:238-245 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) naga/src/front/glsl/context.rs:139 — naga/src/front/glsl/context.rs:139-146 | naga/src/front/glsl/context.rs:151-158 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) wgpu/src/backend/webgpu.rs:654 — wgpu/src/backend/webgpu.rs:654-661 | wgpu/src/backend/webgpu.rs:665-674 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) wgpu-core/src/command/bundle.rs:779 — wgpu-core/src/command/bundle.rs:779-786 | wgpu-core/src/command/render.rs:3916-3923 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) wgpu/src/backend/webgpu.rs:3954 — wgpu/src/backend/webgpu.rs:3954-3962 | wgpu/src/backend/wgpu_core.rs:2639-2646 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) wgpu/src/backend/webgpu.rs:4263 — wgpu/src/backend/webgpu.rs:4263-4271 | wgpu/src/backend/wgpu_core.rs:2975-2982 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) wgpu-core/src/device/trace/record.rs:836 — wgpu-core/src/device/trace/record.rs:836-843 | wgpu-hal/src/dynamic/mod.rs:149-156 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) wgpu-core/src/device/trace/record.rs:310 — wgpu-core/src/device/trace/record.rs:310-317 | wgpu-types/src/texture/external_image.rs:149-156 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) wgpu-core/src/track/buffer.rs:293 — wgpu-core/src/track/buffer.rs:293-304 | wgpu-core/src/track/texture.rs:726-733 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) wgpu-core/src/track/buffer.rs:574 — wgpu-core/src/track/buffer.rs:574-581 | wgpu-core/src/track/texture.rs:466-477 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (18 lines × 2) · ×10
  • 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. Read the line range as the matched WINDOW rather than a finished unit: at `deno_webgpu/compute_pass.rs:162` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 2) naga/src/back/hlsl/writer.rs:4436 — naga/src/back/hlsl/writer.rs:4436-4453 | naga/src/back/wgsl/writer.rs:1709-1726 — `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 19 separate duplicated blocks between them, totalling at least 199 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/hlsl/writer.rs:4436` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 2) 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:979-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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `naga/src/front/spv/next_block.rs:870` calls `span_from_with_op` and `naga/src/front/spv/next_block.rs:977` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (18 lines × 2) naga/src/front/spv/next_block.rs:2448 — naga/src/front/spv/next_block.rs:2448-2465 | naga/src/front/spv/next_block.rs:2493-2510 — both copies are in the same file, so extract the block into 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:384 — naga/src/front/wgsl/lower/construction.rs:384-401 | naga/src/front/wgsl/lower/construction.rs:421-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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/wgsl/lower/construction.rs:384` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 2) naga/src/valid/function.rs:1651 — naga/src/valid/function.rs:1651-1668 | naga/src/valid/function.rs:1672-1689 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/valid/function.rs:1651` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (18 lines × 2) wgpu-core/src/command/mod.rs:232 — wgpu-core/src/command/mod.rs:232-249 | wgpu-core/src/command/mod.rs:276-293 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/command/mod.rs:232` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 2) wgpu-core/src/device/resource.rs:4210 — wgpu-core/src/device/resource.rs:4210-4227 | wgpu-core/src/device/resource.rs:4250-4267 — both copies are in the same file, so extract the block into 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:4665 — wgpu-core/src/device/resource.rs:4665-4682 | wgpu-core/src/device/resource.rs:5422-5439 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/device/resource.rs:4665` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D1 · Cyclomatic Complexity · wgpu_core · ×9
  • wgpu_core::command::ray_tracing::iter_blas (cyclomatic 49) wgpu-core/src/command/ray_tracing.rs:693 — 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::command::ray_tracing::build_acceleration_structures (cyclomatic 24) wgpu-core/src/command/ray_tracing.rs:197 — wgpu_core::command::ray_tracing::build_acceleration_structures 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.
  • 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::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:1464 — 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:693 — 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::command::ray_tracing::build_acceleration_structures (cognitive 47) wgpu-core/src/command/ray_tracing.rs:197 — wgpu_core::command::ray_tracing::build_acceleration_structures has cognitive complexity 47 (threshold 15). Drivers by points: if/else 16 (33 pts), loops 5 (7 pts), match/switch 2 (6 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.
  • 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::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:1464 — 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:3197 — 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.
D4 · Code Duplication · Edited copy of a member (16 corresponding lines) · ×9
  • Edited copy of a member (16 corresponding lines) wgpu-core-remote/src/storage.rs:107 — wgpu-core-remote/src/storage.rs:107-122 | wgpu-core-remote/src/storage.rs:131-146 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) naga/src/front/glsl/types.rs:233 — naga/src/front/glsl/types.rs:233-254 | naga/src/front/glsl/types.rs:318-333 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) wgpu-core/src/indirect_validation/draw.rs:217 — wgpu-core/src/indirect_validation/draw.rs:217-232 | wgpu-core/src/indirect_validation/draw.rs:242-263 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) wgpu-core/src/command/pass.rs:325 — wgpu-core/src/command/pass.rs:325-342 | wgpu-core/src/command/pass.rs:367-382 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) naga-test/src/lib.rs:397 — naga-test/src/lib.rs:397-412 | naga-test/src/lib.rs:415-430 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) wgpu-core/src/command/mod.rs:1877 — wgpu-core/src/command/mod.rs:1877-1892 | wgpu-core/src/command/pass.rs:347-365 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) wgpu-core/src/command/compute.rs:79 — wgpu-core/src/command/compute.rs:79-94 | wgpu-core/src/command/render.rs:330-353 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) wgpu/src/api/device.rs:308 — wgpu/src/api/device.rs:308-323 | wgpu/src/api/device.rs:646-664 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) wgpu-core/src/command/render.rs:3893 — wgpu-core/src/command/render.rs:3893-3908 | wgpu-core/src/command/render.rs:3932-3948 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (6 corresponding lines) · ×9
  • Edited copy of a member (6 corresponding lines) wgpu-core/src/device/trace/record.rs:691 — wgpu-core/src/device/trace/record.rs:691-701 | wgpu-core/src/device/trace/record.rs:921-926 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) naga/src/proc/overloads/list.rs:181 — naga/src/proc/overloads/list.rs:181-187 | naga/src/proc/overloads/regular.rs:262-267 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) wgpu-core/src/command/bundle.rs:633 — wgpu-core/src/command/bundle.rs:633-638 | wgpu-core/src/command/render.rs:3722-3727 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) wgpu-core/src/command/bundle.rs:720 — wgpu-core/src/command/bundle.rs:720-725 | wgpu-core/src/command/render.rs:3762-3767 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) wgpu-core/src/command/transfer.rs:997 — wgpu-core/src/command/transfer.rs:997-1005 | wgpu-core/src/device/queue.rs:1352-1357 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) naga/src/common/wgsl/types.rs:452 — naga/src/common/wgsl/types.rs:452-457 | naga/src/front/wgsl/lower/mod.rs:415-420 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) wgpu-core/src/command/bundle.rs:856 — wgpu-core/src/command/bundle.rs:856-861 | wgpu-core/src/command/render.rs:4023-4028 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) wgpu-core/src/command/bundle.rs:886 — wgpu-core/src/command/bundle.rs:886-894 | wgpu-core/src/command/render.rs:4056-4061 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) wgpu-core/src/command/bundle.rs:906 — wgpu-core/src/command/bundle.rs:906-911 | wgpu-core/src/command/mod.rs:1799-1804 — These two members are one piece of code written twice and then edited apart: 6 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 · Duplicated block (16 lines × 2) · ×9
  • Duplicated block (16 lines × 2) naga/src/back/glsl/writer.rs:1638 — naga/src/back/glsl/writer.rs:1638-1653 | naga/src/back/hlsl/writer.rs:2401-2416 — `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 10 separate duplicated blocks between them, totalling at least 99 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:1465 — naga/src/back/hlsl/help.rs:1465-1480 | naga/src/back/hlsl/help.rs:1507-1522 — both copies are in the same file, so extract the block into 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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/spv/image.rs:623` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/spv/mesh_shader.rs:891` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `naga/src/back/spv/mesh_shader.rs:908` calls `next` and `naga/src/back/spv/mesh_shader.rs:930` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (16 lines × 2) naga/src/front/glsl/builtins.rs:1867 — naga/src/front/glsl/builtins.rs:1867-1882 | naga/src/front/glsl/builtins.rs:1893-1908 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/glsl/builtins.rs:1867` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `naga/src/front/glsl/builtins.rs:1885` calls `Some` and `naga/src/front/glsl/builtins.rs:1911` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (16 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/glsl/parser.rs:274` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 2) 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 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. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/indirect_validation/dispatch.rs:88` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (16 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/track/texture.rs:1256` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (16 lines × 2) naga/src/back/msl/writer.rs:6605 — naga/src/back/msl/writer.rs:6605-6620 | naga/src/back/msl/writer.rs:6700-6717 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/msl/writer.rs:6605` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14 lines × 2) · ×9
  • Duplicated block (14 lines × 2) deno_webgpu/device.rs:499 — deno_webgpu/device.rs:499-512 | deno_webgpu/device.rs:539-552 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `deno_webgpu/device.rs:499` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) naga/src/back/spv/block.rs:3294 — naga/src/back/spv/block.rs:3294-3307 | naga/src/back/spv/block.rs:3394-3407 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/spv/block.rs:3294` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) naga/src/back/spv/ray/mod.rs:69 — naga/src/back/spv/ray/mod.rs:69-82 | naga/src/back/spv/ray/mod.rs:103-116 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (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/valid/analyzer.rs:459 — naga/src/valid/analyzer.rs:459-472 | naga/src/valid/analyzer.rs:475-488 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (14 lines × 2) naga/src/valid/type.rs:391 — naga/src/valid/type.rs:391-404 | naga/src/valid/type.rs:411-424 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/valid/type.rs:391` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) wgpu-core/src/ray_tracing_pipeline.rs:106 — wgpu-core/src/ray_tracing_pipeline.rs:106-119 | wgpu-core/src/ray_tracing_pipeline.rs:121-134 — both copies are in the same file, so extract the block into 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/error.rs:94 — naga/src/front/wgsl/error.rs:94-107 | naga/src/span.rs:292-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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/wgsl/error.rs:94` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/valid/type.rs:324` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D1 · Cyclomatic Complexity · Lowerer · ×8
  • Lowerer::call_builtin (cyclomatic 74) naga/src/front/wgsl/lower/mod.rs:3142 — 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 55) naga/src/front/wgsl/lower/mod.rs:1812 — Lowerer::statement 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.
  • Lowerer::expression_for_reference (cyclomatic 42) naga/src/front/wgsl/lower/mod.rs:2438 — 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:1291 — 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:1578 — 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 20) naga/src/front/wgsl/lower/mod.rs:2865 — Lowerer::finalize_type 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.
  • Lowerer::bitcast_operand (cyclomatic 18) naga/src/front/wgsl/lower/mod.rs:4788 — Lowerer::bitcast_operand 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 · Lowerer · ×8
  • Lowerer::statement (cognitive 98) naga/src/front/wgsl/lower/mod.rs:1812 — Lowerer::statement has cognitive complexity 98 (threshold 15). Drivers by points: if/else 20 (49 pts), match/switch 20 (46 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 56). 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::call_builtin (cognitive 90) naga/src/front/wgsl/lower/mod.rs:3142 — 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::expression_for_reference (cognitive 56) naga/src/front/wgsl/lower/mod.rs:2438 — 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:1578 — 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:4908 — 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:1291 — 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:4324 — 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:2865 — 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.
D4 · Code Duplication · Edited copy of a member (10 corresponding lines) · ×8
  • Edited copy of a member (10 corresponding lines) naga/src/proc/overloads/mathfunction.rs:195 — naga/src/proc/overloads/mathfunction.rs:195-204 | naga/src/proc/overloads/mathfunction.rs:206-216 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) deno_webgpu/adapter.rs:578 — deno_webgpu/adapter.rs:578-587 | deno_webgpu/lib.rs:296-305 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) naga/src/back/spv/writer.rs:2727 — naga/src/back/spv/writer.rs:2727-2736 | naga/src/back/spv/writer.rs:2789-2801 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) wgpu/src/backend/wgpu_core.rs:1857 — wgpu/src/backend/wgpu_core.rs:1857-1869 | wgpu/src/backend/wgpu_core.rs:2357-2366 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) wgpu-core/src/command/mod.rs:705 — wgpu-core/src/command/mod.rs:705-714 | wgpu-core/src/command/mod.rs:726-735 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) wgpu-core/src/command/render.rs:355 — wgpu-core/src/command/render.rs:355-368 | wgpu-core/src/command/compute.rs:96-105 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) wgpu-core/src/ray_tracing.rs:53 — wgpu-core/src/ray_tracing.rs:53-62 | wgpu-core/src/resource.rs:3361-3372 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) wgpu-sync/src/mutex.rs:102 — wgpu-sync/src/mutex.rs:102-111 | wgpu-sync/src/rwlock.rs:113-122 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (7 lines × 3) · ×8
  • Duplicated block (7 lines × 3) naga/src/front/wgsl/lower/mod.rs:1700 — naga/src/front/wgsl/lower/mod.rs:1700-1706 | naga/src/front/wgsl/lower/mod.rs:1732-1738 | naga/src/front/wgsl/lower/mod.rs:1747-1753 — 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:3407 — naga/src/front/wgsl/lower/mod.rs:3407-3413 | naga/src/front/wgsl/lower/mod.rs:3543-3549 | naga/src/front/wgsl/lower/mod.rs:3582-3588 — 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/back/hlsl/writer.rs:2926 — naga/src/back/hlsl/writer.rs:2926-2932 | naga/src/back/hlsl/writer.rs:3135-3141 | naga/src/back/hlsl/writer.rs:3199-3205 — 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/back/hlsl/help.rs:1118 — naga/src/back/hlsl/help.rs:1118-1124 | naga/src/back/hlsl/help.rs:1179-1185 | naga/src/back/hlsl/help.rs:1258-1264 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `self` to `super) fn write_wrapped_struct_matrix_set_function( &mut` in one and `super) fn write_wrapped_struct_matrix_set_vec_function( &mut` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (7 lines × 3) wgpu-core/src/binding_model.rs:1530 — wgpu-core/src/binding_model.rs:1530-1536 | wgpu-core/src/pipeline.rs:757-763 | wgpu-core/src/resource.rs:3285-3291 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wgpu-core/src/pipeline.rs:765` calls `pub`, `check_is_valid`, `raw` and `wgpu-core/src/resource.rs:3293` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 3) wgpu-core/src/command/compute.rs:308 — wgpu-core/src/command/compute.rs:308-314 | wgpu-core/src/command/ray_tracing_pass.rs:361-367 | wgpu-core/src/command/render.rs:723-729 — before extracting anything, compare `wgpu-core/src/command/compute.rs` and `wgpu-core/src/command/ray_tracing_pass.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 180 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 3) wgpu-core/src/command/compute.rs:1359 — wgpu-core/src/command/compute.rs:1359-1365 | wgpu-core/src/command/ray_tracing_pass.rs:509-515 | wgpu-core/src/command/render.rs:4387-4393 — before extracting anything, compare `wgpu-core/src/command/compute.rs` and `wgpu-core/src/command/ray_tracing_pass.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 180 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 3) naga/src/front/wgsl/lower/mod.rs:3752 — naga/src/front/wgsl/lower/mod.rs:3752-3758 | naga/src/front/wgsl/lower/mod.rs:3763-3769 | naga/src/front/wgsl/lower/mod.rs:3774-3780 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/wgsl/lower/mod.rs:3752` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
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:3560 — 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:2883 — 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:2598 — 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_image_sample (cognitive 22) naga/src/back/spv/image.rs:803 — BlockContext::write_image_sample has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (16 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.
  • BlockContext::write_image_query (cognitive 22) naga/src/back/spv/image.rs:1151 — 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_as_expression (cognitive 20) naga/src/back/spv/block.rs:2326 — BlockContext::write_as_expression has cognitive complexity 20 (threshold 15). Drivers by points: match/switch 8 (12 pts), if/else 3 (5 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 7). 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.
D30 · Dependency Vulnerabilities · Medium advisory (unmaintained) · ×7
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Edited copy of a member (14 corresponding lines) · ×7
  • Edited copy of a member (14 corresponding lines) naga/src/back/glsl/writer.rs:1509 — naga/src/back/glsl/writer.rs:1509-1522 | naga/src/back/hlsl/writer.rs:1407-1421 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) wgpu-core/src/pipeline.rs:733 — wgpu-core/src/pipeline.rs:733-748 | wgpu-core/src/resource.rs:3268-3281 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) wgpu-core/src/pipeline.rs:332 — wgpu-core/src/pipeline.rs:332-348 | wgpu/src/backend/webgpu.rs:1979-1992 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) wgpu-types/src/write_only.rs:588 — wgpu-types/src/write_only.rs:588-601 | wgpu-types/src/write_only.rs:609-622 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) wgpu-hal/src/vulkan/device.rs:2786 — wgpu-hal/src/vulkan/device.rs:2786-2800 | wgpu-hal/src/vulkan/device.rs:2801-2814 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) naga/src/front/spv/image.rs:252 — naga/src/front/spv/image.rs:252-265 | naga/src/front/spv/mod.rs:2709-2722 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) wgpu/src/api/adapter.rs:64 — wgpu/src/api/adapter.rs:64-77 | wgpu/src/api/adapter.rs:90-103 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (13 corresponding lines) · ×7
  • Edited copy of a member (13 corresponding lines) wgpu-core/src/indirect_validation/draw.rs:842 — wgpu-core/src/indirect_validation/draw.rs:842-854 | wgpu-core/src/indirect_validation/draw.rs:860-872 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) wgpu/src/backend/wgpu_core.rs:2448 — wgpu/src/backend/wgpu_core.rs:2448-2460 | wgpu/src/backend/wgpu_core.rs:2545-2557 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) wgpu-hal/src/gles/device.rs:139 — wgpu-hal/src/gles/device.rs:139-152 | wgpu-hal/src/gles/device.rs:166-178 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) naga/src/back/hlsl/mod.rs:606 — naga/src/back/hlsl/mod.rs:606-618 | naga/src/back/hlsl/mod.rs:623-641 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) naga/src/compact/mod.rs:545 — naga/src/compact/mod.rs:545-557 | naga/src/compact/mod.rs:562-576 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) wgpu-types/src/texture.rs:645 — wgpu-types/src/texture.rs:645-657 | wgpu-types/src/texture.rs:665-677 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) wgpu-core/src/pipeline.rs:988 — wgpu-core/src/pipeline.rs:988-1000 | wgpu-core/src/pipeline.rs:1005-1017 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (12 corresponding lines) · ×7
  • Edited copy of a member (12 corresponding lines) wgpu-core/src/instance.rs:323 — wgpu-core/src/instance.rs:323-351 | wgpu-core/src/instance.rs:357-368 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) wgpu-info/src/human.rs:29 — wgpu-info/src/human.rs:29-40 | wgpu-info/src/human.rs:42-53 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) wgpu/src/api/device.rs:1065 — wgpu/src/api/device.rs:1065-1078 | wgpu/src/api/device.rs:1082-1093 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) wgpu-core/src/device/life.rs:236 — wgpu-core/src/device/life.rs:236-250 | wgpu-core/src/device/life.rs:252-263 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) wgpu-core/src/resource.rs:139 — wgpu-core/src/resource.rs:139-150 | wgpu-core/src/resource.rs:152-163 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) wgpu/src/util/belt.rs:266 — wgpu/src/util/belt.rs:266-279 | wgpu/src/util/belt.rs:301-312 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) naga/src/back/glsl/mod.rs:114 — naga/src/back/glsl/mod.rs:114-125 | naga/src/back/wgsl/mod.rs:77-89 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (20 lines × 2) · ×7
  • Duplicated block (20 lines × 2) naga/src/back/hlsl/help.rs:1681 — naga/src/back/hlsl/help.rs:1681-1700 | naga/src/back/hlsl/help.rs:1746-1765 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/hlsl/help.rs:1681` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (20 lines × 2) naga/src/front/spv/mod.rs:1155 — naga/src/front/spv/mod.rs:1155-1174 | naga/src/front/spv/mod.rs:1225-1244 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/spv/mod.rs:1155` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/command/bundle.rs:467` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (20 lines × 2) wgpu-core/src/command/ray_tracing.rs:715 — wgpu-core/src/command/ray_tracing.rs:715-734 | wgpu-core/src/command/ray_tracing.rs:1060-1079 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/command/ray_tracing.rs:715` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (20 lines × 2) wgpu-hal/src/gles/device.rs:269 — wgpu-hal/src/gles/device.rs:269-288 | wgpu-hal/src/gles/device.rs:722-741 — both copies are in the same file, so extract the block into 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. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-hal/src/gles/egl.rs:1171` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (20 lines × 2) wgpu-hal/src/metal/conv.rs:439 — wgpu-hal/src/metal/conv.rs:439-458 | wgpu-hal/src/metal/conv.rs:470-489 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-hal/src/metal/conv.rs:439` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6 lines × 3) · ×7
  • 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:1306-1311 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `naga/src/front/spv/mod.rs:1036` calls `next` and `naga/src/front/spv/mod.rs:1006` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 3) naga/src/front/spv/mod.rs:1198 — naga/src/front/spv/mod.rs:1198-1203 | naga/src/front/spv/mod.rs:1205-1210 | naga/src/front/spv/mod.rs:1266-1272 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `naga/src/front/spv/mod.rs:1263` calls `lookup`, `get_expr_handle` and `naga/src/front/spv/mod.rs:1195` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 3) wgpu-core/src/binding_model.rs:1343 — wgpu-core/src/binding_model.rs:1343-1348 | wgpu-core/src/binding_model.rs:1832-1837 | wgpu-core/src/pipeline.rs:133-138 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wgpu-core/src/binding_model.rs:1839` calls `pub`, `check_is_valid`, `state` and `wgpu-core/src/pipeline.rs:140` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 3) wgpu-core/src/pipeline.rs:641 — wgpu-core/src/pipeline.rs:641-646 | wgpu-core/src/pipeline.rs:1275-1280 | wgpu-core/src/ray_tracing_pipeline.rs:291-296 — before extracting anything, compare `wgpu-core/src/pipeline.rs` and `wgpu-core/src/ray_tracing_pipeline.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 30 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 × 3) wgpu-core/src/pipeline.rs:648 — wgpu-core/src/pipeline.rs:648-653 | wgpu-core/src/pipeline.rs:1282-1287 | wgpu-core/src/ray_tracing_pipeline.rs:316-321 — before extracting anything, compare `wgpu-core/src/pipeline.rs` and `wgpu-core/src/ray_tracing_pipeline.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 30 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 × 3) naga/src/back/msl/writer.rs:5264 — naga/src/back/msl/writer.rs:5264-5269 | naga/src/back/msl/writer.rs:5446-5456 | naga/src/back/msl/writer.rs:5832-5842 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/msl/writer.rs:5264` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 3) 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. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-hal/src/auxil/dxgi/dxgi_lib.rs:50` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (5 lines × 3) · ×7
  • 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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/hlsl/storage.rs:357` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 3) naga/src/front/wgsl/lower/mod.rs:4521 — naga/src/front/wgsl/lower/mod.rs:4521-4525 | naga/src/front/wgsl/lower/mod.rs:5397-5401 | naga/src/front/wgsl/lower/mod.rs:5420-5424 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/wgsl/lower/mod.rs:4521` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 3) 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (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:4031 — naga/src/back/hlsl/writer.rs:4031-4048 | naga/src/back/hlsl/writer.rs:4058-4064 | naga/src/back/hlsl/writer.rs:4074-4078 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/hlsl/writer.rs:4031` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (5 lines × 3) naga/src/back/glsl/writer.rs:2196 — naga/src/back/glsl/writer.rs:2196-2200 | naga/src/back/hlsl/writer.rs:3145-3149 | naga/src/back/wgsl/writer.rs:1119-1123 — `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 10 separate duplicated blocks between them, totalling at least 99 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/glsl/writer.rs:2196` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 3) naga/src/back/msl/writer.rs:2502 — naga/src/back/msl/writer.rs:2502-2506 | naga/src/back/msl/writer.rs:2511-2515 | naga/src/back/msl/writer.rs:2521-2525 — 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 · BlockContext · ×6
  • BlockContext::cache_expression_value (cyclomatic 251) naga/src/back/spv/block.rs:790 — BlockContext::cache_expression_value has cyclomatic complexity 251 (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 84) naga/src/back/spv/block.rs:3560 — BlockContext::write_block has cyclomatic complexity 84 (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 30) naga/src/back/spv/block.rs:2326 — BlockContext::write_as_expression 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.
  • BlockContext::write_image_sample (cyclomatic 19) naga/src/back/spv/image.rs:803 — BlockContext::write_image_sample 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.
  • BlockContext::write_access_chain (cyclomatic 18) naga/src/back/spv/block.rs:2598 — 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_query (cyclomatic 18) naga/src/back/spv/image.rs:1151 — 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 · Edited copy of a member (17 corresponding lines) · ×6
  • Edited copy of a member (17 corresponding lines) naga/src/front/spv/mod.rs:2866 — naga/src/front/spv/mod.rs:2866-2882 | naga/src/front/spv/mod.rs:2889-2906 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) wgpu-core/src/device/resource.rs:3819 — wgpu-core/src/device/resource.rs:3819-3843 | wgpu-core/src/device/resource.rs:5605-5621 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) wgpu-hal/src/gles/device.rs:1683 — wgpu-hal/src/gles/device.rs:1683-1699 | wgpu-hal/src/gles/device.rs:1719-1735 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) naga/src/proc/overloads/mathfunction.rs:145 — naga/src/proc/overloads/mathfunction.rs:145-163 | naga/src/proc/overloads/mathfunction.rs:177-193 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) wgpu-types/src/limits.rs:961 — wgpu-types/src/limits.rs:961-977 | wgpu-types/src/limits.rs:985-1001 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) naga/src/back/hlsl/writer.rs:216 — naga/src/back/hlsl/writer.rs:216-233 | naga/src/back/msl/writer.rs:1156-1172 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 6+ corresponding lines) · ×6
  • Edited copies of one member (3 members, 6+ corresponding lines) wgpu-core/src/command/clear.rs:139 — wgpu-core/src/command/clear.rs:139-144 | wgpu-core/src/command/transfer.rs:946-954 | wgpu-core/src/device/queue.rs:934-939 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 6+ corresponding lines) wgpu-core/src/command/clear.rs:169 — wgpu-core/src/command/clear.rs:169-174 | wgpu-core/src/command/ray_tracing.rs:96-104 | wgpu-core/src/command/transition_resources.rs:52-60 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 6+ corresponding lines) wgpu-core/src/command/compute.rs:1352 — wgpu-core/src/command/compute.rs:1352-1357 | wgpu-core/src/command/ray_tracing_pass.rs:502-507 | wgpu-core/src/command/render.rs:4380-4385 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 6+ corresponding lines) wgpu-core/src/command/compute.rs:1388 — wgpu-core/src/command/compute.rs:1388-1393 | wgpu-core/src/command/ray_tracing_pass.rs:542-547 | wgpu-core/src/command/render.rs:4416-4421 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 6+ corresponding lines) wgpu-core/src/command/compute.rs:614 — wgpu-core/src/command/compute.rs:614-619 | wgpu-core/src/command/ray_tracing_pass.rs:477-482 | wgpu-core/src/command/render.rs:2257-2262 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 6+ corresponding lines) wgpu-core/src/command/compute.rs:1413 — wgpu-core/src/command/compute.rs:1413-1418 | wgpu-core/src/command/query.rs:445-450 | wgpu-core/src/command/render.rs:4440-4445 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (10 lines × 3) · ×6
  • Duplicated block (10 lines × 3) naga/src/back/hlsl/writer.rs:3588 — naga/src/back/hlsl/writer.rs:3588-3597 | naga/src/back/hlsl/writer.rs:3620-3629 | naga/src/back/hlsl/writer.rs:3633-3642 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/hlsl/writer.rs:3588` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 3) naga/src/back/spv/instructions.rs:799 — naga/src/back/spv/instructions.rs:799-808 | naga/src/back/spv/instructions.rs:902-911 | naga/src/back/spv/instructions.rs:937-946 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/spv/instructions.rs:799` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `naga/src/back/spv/instructions.rs:899` calls `add_operand` and `naga/src/back/spv/instructions.rs:798` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 3) wgpu-core/src/command/compute.rs:653 — wgpu-core/src/command/compute.rs:653-662 | wgpu-core/src/command/ray_tracing_pass.rs:701-710 | wgpu-core/src/command/render.rs:2345-2355 — before extracting anything, compare `wgpu-core/src/command/compute.rs` and `wgpu-core/src/command/ray_tracing_pass.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 180 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/command/compute.rs:653` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wgpu-core/src/command/render.rs:2357` calls `new_usage_scope` and `wgpu-core/src/command/compute.rs:663` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 3) wgpu-core/src/pipeline.rs:619 — wgpu-core/src/pipeline.rs:619-628 | wgpu-core/src/pipeline.rs:1253-1262 | wgpu-core/src/ray_tracing_pipeline.rs:267-278 — before extracting anything, compare `wgpu-core/src/pipeline.rs` and `wgpu-core/src/ray_tracing_pipeline.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 30 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/pipeline.rs:619` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (10 lines × 3) naga/src/back/glsl/mod.rs:102 — naga/src/back/glsl/mod.rs:102-111 | naga/src/back/hlsl/mod.rs:247-256 | naga/src/back/msl/mod.rs:136-145 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (10 lines × 3) naga/src/back/msl/writer.rs:5277 — naga/src/back/msl/writer.rs:5277-5286 | naga/src/back/msl/writer.rs:5468-5480 | naga/src/back/msl/writer.rs:5889-5901 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/msl/writer.rs:5277` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D1 · Cyclomatic Complexity · Adapter · ×5
  • Adapter::expose (cyclomatic 103) wgpu-hal/src/dx12/adapter.rs:159 — 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:1162 — 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:196 — 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:2663 — 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:2850 — 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:1481 — 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:2478 — 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:3692 — 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:2792 — 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.
D2 · Cognitive Complexity · wgpu_hal · ×5
  • 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::metal::icb_probe::supports_render_icb (cognitive 23) wgpu-hal/src/metal/icb_probe.rs:21 — wgpu_hal::metal::icb_probe::supports_render_icb has cognitive complexity 23 (threshold 15). Drivers by points: if/else 19 (20 pts), match/switch 3 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • 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:1483 — 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.
D4 · Code Duplication · Edited copy of a member (19 corresponding lines) · ×5
  • Edited copy of a member (19 corresponding lines) wgpu-hal/src/dx12/suballocation.rs:205 — wgpu-hal/src/dx12/suballocation.rs:205-223 | wgpu-hal/src/dx12/suballocation.rs:229-249 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) naga/src/back/glsl/writer.rs:994 — naga/src/back/glsl/writer.rs:994-1012 | naga/src/back/glsl/writer.rs:1019-1037 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) wgpu-core-remote/src/global/instance.rs:169 — wgpu-core-remote/src/global/instance.rs:169-189 | wgpu-core-remote/src/global/instance.rs:214-232 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) naga/src/front/wgsl/lower/mod.rs:214 — naga/src/front/wgsl/lower/mod.rs:214-232 | naga/src/front/wgsl/lower/mod.rs:241-259 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) deno_webgpu/webidl.rs:417 — deno_webgpu/webidl.rs:417-439 | deno_webgpu/webidl.rs:466-484 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (7 corresponding lines) · ×5
  • Edited copy of a member (7 corresponding lines) wgpu-hal/src/metal/mod.rs:605 — wgpu-hal/src/metal/mod.rs:605-611 | wgpu-hal/src/metal/mod.rs:630-636 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) wgpu-core/src/ray_tracing.rs:78 — wgpu-core/src/ray_tracing.rs:78-84 | wgpu-core/src/resource.rs:3389-3396 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) wgpu-core/src/lock/observing.rs:74 — wgpu-core/src/lock/observing.rs:74-80 | wgpu-core/src/lock/ranked.rs:230-236 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) wgpu-core/src/lock/observing.rs:149 — wgpu-core/src/lock/observing.rs:149-155 | wgpu-core/src/lock/ranked.rs:306-312 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) wgpu-core/src/lock/observing.rs:158 — wgpu-core/src/lock/observing.rs:158-164 | wgpu-core/src/lock/ranked.rs:315-321 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (22 lines × 2) · ×5
  • Duplicated block (22 lines × 2) naga/src/back/glsl/writer.rs:2251 — naga/src/back/glsl/writer.rs:2251-2272 | naga/src/back/wgsl/writer.rs:1172-1193 — `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 10 separate duplicated blocks between them, totalling at least 141 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/glsl/writer.rs:2251` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (22 lines × 2) naga/src/front/spv/mod.rs:2433 — naga/src/front/spv/mod.rs:2433-2454 | naga/src/front/spv/mod.rs:2484-2505 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/spv/mod.rs:2433` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (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 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. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/indirect_validation/dispatch.rs:302` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-hal/src/dx12/suballocation.rs:461` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (22 lines × 2) wgpu/src/backend/wgpu_core.rs:1302 — wgpu/src/backend/wgpu_core.rs:1302-1323 | wgpu/src/backend/wgpu_core.rs:1385-1406 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `desc` to `&crate::RenderPipelineDescriptor<'_>` in one and `&crate::MeshPipelineDescriptor<'_>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (21 lines × 2) · ×5
  • Duplicated block (21 lines × 2) naga/src/back/msl/writer.rs:6098 — naga/src/back/msl/writer.rs:6098-6118 | naga/src/back/msl/writer.rs:6372-6392 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/msl/writer.rs:6098` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (21 lines × 2) naga/src/front/glsl/functions.rs:1035 — naga/src/front/glsl/functions.rs:1035-1055 | naga/src/front/glsl/functions.rs:1124-1144 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/glsl/functions.rs:1035` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (21 lines × 2) wgpu-core/src/command/bundle.rs:1244 — wgpu-core/src/command/bundle.rs:1244-1264 | wgpu-core/src/command/render.rs:3162-3182 — 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:1548 — wgpu-hal/src/dx12/command.rs:1548-1568 | wgpu-hal/src/dx12/command.rs:1587-1607 — both copies are in the same file, so extract the block into 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. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-hal/src/dx12/suballocation.rs:427` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (12 lines × 3) · ×5
  • 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. Read the line range as the matched WINDOW rather than a finished unit: at `deno_webgpu/compute_pass.rs:168` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 3) naga/src/back/msl/ray.rs:414 — naga/src/back/msl/ray.rs:414-425 | naga/src/back/msl/ray.rs:468-479 | naga/src/back/msl/ray.rs:498-509 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/msl/ray.rs:414` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 3) 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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/spv/mesh_shader.rs:85` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 3) 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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/glsl/builtins.rs:349` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 3) naga/src/front/wgsl/lower/mod.rs:3638 — naga/src/front/wgsl/lower/mod.rs:3638-3649 | naga/src/front/wgsl/lower/mod.rs:3651-3662 | naga/src/front/wgsl/lower/mod.rs:3664-3675 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/wgsl/lower/mod.rs:3638` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (9 lines × 3) · ×5
  • 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. Read the line range as the matched WINDOW rather than a finished unit: at `deno_webgpu/webidl.rs:46` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/glsl/parser.rs:270` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (9 lines × 3) naga/src/front/wgsl/lower/mod.rs:3690 — naga/src/front/wgsl/lower/mod.rs:3690-3698 | naga/src/front/wgsl/lower/mod.rs:3977-3985 | naga/src/front/wgsl/lower/mod.rs:5221-5229 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/wgsl/lower/mod.rs:3690` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (9 lines × 3) wgpu-core/src/command/compute.rs:579 — wgpu-core/src/command/compute.rs:579-587 | wgpu-core/src/command/ray_tracing_pass.rs:447-455 | wgpu-core/src/command/render.rs:2220-2228 — before extracting anything, compare `wgpu-core/src/command/compute.rs` and `wgpu-core/src/command/ray_tracing_pass.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 180 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/command/compute.rs:579` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-hal/src/gles/queue.rs:1821` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
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.78 — 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:2478 — 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:2850 — 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:1481 — 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:2792 — 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:1634 — 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:1360 — 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:1098 — 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:159 — 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:2663 — 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 48) wgpu-hal/src/metal/adapter.rs:196 — Adapter::texture_format_capabilities has cognitive complexity 48 (threshold 15). Drivers by points: if/else 30 (44 pts), boolean chains 2, match/switch 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 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_adapters (cognitive 29) wgpu-core/src/instance.rs:442 — Instance::request_adapters has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (24 pts), loops 2 (3 pts), match/switch 2 (nesting depth added 13). Of this number, 28 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::expose_adapter (cognitive 26) wgpu-hal/src/vulkan/adapter.rs:2284 — Instance::expose_adapter has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 10, match/switch 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.
  • 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.
D3 · God Classes · TooManyFields · ×4
  • TooManyFields: CapabilitiesQuery wgpu-hal/src/metal/mod.rs:229 — TooManyFields — 109 stored fields beside 7 methods. The bar is 30 stored fields; this is 79 over it, 3.63× 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:929 — TooManyFields — 40 stored fields beside 105 methods. The bar is 30 stored fields; this is 10 over it, 1.33× 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:237 — TooManyFields — 31 stored fields beside 106 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 · Edited copy of a member (15 corresponding lines) · ×4
  • 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.
  • Edited copy of a member (15 corresponding lines) naga/src/front/wgsl/parse/lexer.rs:579 — naga/src/front/wgsl/parse/lexer.rs:579-593 | naga/src/front/wgsl/parse/lexer.rs:596-610 — 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.
  • Edited copy of a member (15 corresponding lines) wgpu-core/src/device/life.rs:399 — wgpu-core/src/device/life.rs:399-413 | wgpu-core/src/device/life.rs:420-434 — 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.
  • Edited copy of a member (15 corresponding lines) wgpu-hal/src/dx12/command.rs:987 — wgpu-hal/src/dx12/command.rs:987-1005 | wgpu-hal/src/dx12/command.rs:1988-2002 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (21 corresponding lines) · ×4
  • Edited copy of a member (21 corresponding lines) wgpu-hal/src/dx12/mod.rs:148 — wgpu-hal/src/dx12/mod.rs:148-175 | wgpu-hal/src/dx12/mod.rs:256-276 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) wgpu-core/src/command/compute.rs:286 — wgpu-core/src/command/compute.rs:286-306 | wgpu-core/src/command/ray_tracing_pass.rs:339-359 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) wgpu-hal/src/gles/egl.rs:248 — wgpu-hal/src/gles/egl.rs:248-269 | wgpu-hal/src/gles/wgl.rs:155-175 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) wgpu-core/src/track/buffer.rs:604 — wgpu-core/src/track/buffer.rs:604-624 | wgpu-core/src/track/texture.rs:756-777 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (18 corresponding lines) · ×4
  • Edited copy of a member (18 corresponding lines) naga/src/proc/constant_evaluator.rs:4124 — naga/src/proc/constant_evaluator.rs:4124-4141 | naga/src/proc/constant_evaluator.rs:4204-4226 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) naga/src/back/glsl/writer.rs:1532 — naga/src/back/glsl/writer.rs:1532-1559 | naga/src/back/msl/writer.rs:1897-1914 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) wgpu-core/src/command/bundle.rs:837 — wgpu-core/src/command/bundle.rs:837-854 | wgpu-core/src/command/bundle.rs:867-884 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) wgpu-core/src/track/buffer.rs:199 — wgpu-core/src/track/buffer.rs:199-216 | wgpu-core/src/track/buffer.rs:363-382 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D6 · Cohesion (LCOM4) · Low cohesion · ×4
  • Low cohesion: Device (LCOM4 9) wgpu-hal/src/dx12/mod.rs:661 — 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:237 — 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:1634 — 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:1360 — 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 26) wgpu-hal/src/vulkan/adapter.rs:2284 — Instance::expose_adapter has cyclomatic complexity 26 (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_adapters (cyclomatic 20) wgpu-core/src/instance.rs:442 — Instance::request_adapters has cyclomatic complexity 20 (threshold 15). Of this number, 14 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 · FunctionInfo · ×3
  • FunctionInfo::process_block (cognitive 65) naga/src/valid/analyzer.rs:894 — FunctionInfo::process_block has cognitive complexity 65 (threshold 15). Drivers by points: if/else 13 (37 pts), match/switch 5 (14 pts), loops 5 (13 pts), boolean chains 1 (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.
  • FunctionInfo::process_expression (cognitive 42) naga/src/valid/analyzer.rs:539 — 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:447 — 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 · 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 · 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 · Edited copy of a member (30 corresponding lines) · ×3
  • Edited copy of a member (30 corresponding lines) naga/src/back/spv/writer.rs:2886 — naga/src/back/spv/writer.rs:2886-2923 | naga/src/back/spv/writer.rs:2925-2954 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (30 corresponding lines) wgpu-hal/src/metal/command.rs:702 — wgpu-hal/src/metal/command.rs:702-737 | wgpu-hal/src/metal/command.rs:747-776 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (30 corresponding lines) wgpu-core/src/indirect_validation/dispatch.rs:294 — wgpu-core/src/indirect_validation/dispatch.rs:294-323 | wgpu-core/src/indirect_validation/draw.rs:182-211 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (24 corresponding lines) · ×3
  • Edited copy of a member (24 corresponding lines) wgpu-hal/src/auxil/dxgi/dxgi_lib.rs:19 — wgpu-hal/src/auxil/dxgi/dxgi_lib.rs:19-43 | wgpu-hal/src/dx12/mod.rs:225-248 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) naga/src/back/spv/writer.rs:3139 — naga/src/back/spv/writer.rs:3139-3162 | naga/src/back/spv/writer.rs:3169-3217 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) wgpu-hal/src/dx12/command.rs:215 — wgpu-hal/src/dx12/command.rs:215-243 | wgpu-hal/src/dx12/command.rs:245-268 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (23 corresponding lines) · ×3
  • Edited copy of a member (23 corresponding lines) naga/src/back/msl/writer.rs:1492 — naga/src/back/msl/writer.rs:1492-1520 | naga/src/back/msl/writer.rs:1637-1659 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) wgpu-core/src/command/mod.rs:222 — wgpu-core/src/command/mod.rs:222-249 | wgpu-core/src/command/mod.rs:271-293 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) naga/src/back/glsl/writer.rs:462 — naga/src/back/glsl/writer.rs:462-486 | naga/src/back/hlsl/writer.rs:1428-1450 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 18+ corresponding lines) · ×3
  • Edited copies of one member (3 members, 18+ corresponding lines) wgpu-core/src/binding_model.rs:1793 — wgpu-core/src/binding_model.rs:1793-1810 | wgpu-core/src/resource.rs:3626-3650 | wgpu-core/src/resource.rs:3873-3892 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 18+ corresponding lines) naga/src/front/wgsl/lower/mod.rs:4520 — naga/src/front/wgsl/lower/mod.rs:4520-4537 | naga/src/front/wgsl/lower/mod.rs:5396-5413 | naga/src/front/wgsl/lower/mod.rs:5419-5436 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 18+ corresponding lines) deno_webgpu/command_encoder.rs:297 — deno_webgpu/command_encoder.rs:297-318 | deno_webgpu/command_encoder.rs:328-347 | deno_webgpu/queue.rs:146-163 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 12+ corresponding lines) · ×3
  • Edited copies of one member (3 members, 12+ corresponding lines) naga/src/back/spv/instructions.rs:797 — naga/src/back/spv/instructions.rs:797-808 | naga/src/back/spv/instructions.rs:897-911 | naga/src/back/spv/instructions.rs:931-946 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 12+ corresponding lines) naga/src/back/msl/mod.rs:583 — naga/src/back/msl/mod.rs:583-594 | naga/src/back/msl/mod.rs:599-615 | naga/src/back/msl/mod.rs:620-636 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 12+ corresponding lines) naga/src/front/glsl/error.rs:212 — naga/src/front/glsl/error.rs:212-225 | naga/src/front/spv/error.rs:180-191 | naga/src/span.rs:319-330 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 6+ corresponding lines) · ×3
  • Edited copies of one member (4 members, 6+ corresponding lines) wgpu-core/src/command/bundle.rs:671 — wgpu-core/src/command/bundle.rs:671-676 | wgpu-core/src/command/compute.rs:1220-1225 | wgpu-core/src/command/ray_tracing_pass.rs:113-118 | wgpu-core/src/command/render.rs:3660-3665 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 6+ corresponding lines) wgpu-core/src/command/bundle.rs:743 — wgpu-core/src/command/bundle.rs:743-748 | wgpu-core/src/command/compute.rs:1281-1286 | wgpu-core/src/command/ray_tracing_pass.rs:178-183 | wgpu-core/src/command/render.rs:3880-3885 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 6+ corresponding lines) wgpu-core/src/command/bundle.rs:690 — wgpu-core/src/command/bundle.rs:690-695 | wgpu-core/src/command/compute.rs:1253-1258 | wgpu-core/src/command/ray_tracing_pass.rs:415-420 | wgpu-core/src/command/render.rs:3687-3692 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (23 lines × 2) · ×3
  • Duplicated block (23 lines × 2) naga/src/back/hlsl/writer.rs:5289 — naga/src/back/hlsl/writer.rs:5289-5311 | naga/src/back/hlsl/writer.rs:5347-5369 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/hlsl/writer.rs:5289` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (23 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/glsl/builtins.rs:1015` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (23 lines × 2) wgpu-core/src/device/queue.rs:1181 — wgpu-core/src/device/queue.rs:1181-1203 | wgpu-core/src/device/queue.rs:1467-1489 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/device/queue.rs:1181` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: `wgpu-core/src/device/queue.rs:1467` is reached only past guards at line 1404 (testing `dst.desc.format`) and line 1409 (testing `dst.desc.dimension`) that each leave the function early, and `wgpu-core/src/device/queue.rs:1181` reads `dst.desc.dimension` and `dst.desc.format` with no such check. What separates these copies is not which lines they run but which PRECONDITION they enforce, so one of them is operating on state the other one refuses. Decide which is intended BEFORE unifying them — extract the shared part and whichever copy is missing the check keeps running unchecked, and if the guard is the correct behaviour then that hole is already live.
D4 · Code Duplication · Duplicated block (19 lines × 2) · ×3
  • Duplicated block (19 lines × 2) naga/src/back/hlsl/writer.rs:2445 — naga/src/back/hlsl/writer.rs:2445-2463 | naga/src/back/wgsl/writer.rs:806-824 — `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 19 separate duplicated blocks between them, totalling at least 199 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/hlsl/writer.rs:2445` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (19 lines × 2) wgpu-core/src/command/compute.rs:673 — wgpu-core/src/command/compute.rs:673-691 | wgpu-core/src/command/ray_tracing_pass.rs:721-739 — before extracting anything, compare `wgpu-core/src/command/compute.rs` and `wgpu-core/src/command/ray_tracing_pass.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 180 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/command/compute.rs:673` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/track/texture.rs:847` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D1 · Cyclomatic Complexity · Interface · ×2
  • Interface::check_stage (cyclomatic 89) wgpu-core/src/validation.rs:1682 — Interface::check_stage has cyclomatic complexity 89 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Interface::new (cyclomatic 24) wgpu-core/src/validation.rs:1474 — Interface::new 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. 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 52) naga/src/valid/analyzer.rs:539 — FunctionInfo::process_expression has cyclomatic complexity 52 (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 52) naga/src/valid/analyzer.rs:894 — FunctionInfo::process_block has cyclomatic complexity 52 (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:777 — 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:979 — 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 · wgpu_hal · ×2
  • wgpu_hal::metal::icb_probe::supports_render_icb (cyclomatic 23) wgpu-hal/src/metal/icb_probe.rs:21 — wgpu_hal::metal::icb_probe::supports_render_icb 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.
  • 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 · 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:189 — // 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 157) wgpu-core/src/validation.rs:1682 — Interface::check_stage has cognitive complexity 157 (threshold 15). Drivers by points: if/else 48 (98 pts), match/switch 15 (36 pts), loops 9 (16 pts), boolean chains 7 (nesting depth added 78). To reduce it, split the body into named stages: move each independent 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 45) wgpu-core/src/validation.rs:1474 — Interface::new has cognitive complexity 45 (threshold 15). Drivers by points: if/else 10 (26 pts), loops 6 (11 pts), match/switch 3 (7 pts), 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.
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:777 — 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:979 — 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:1376 — 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.
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:1031 — naga/src/back/hlsl/help.rs:1031-1036 | naga/src/back/hlsl/help.rs:1095-1100 | naga/src/back/hlsl/help.rs:1155-1160 | naga/src/back/hlsl/help.rs:1233-1238 — 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:2124 — naga/src/front/spv/mod.rs:2124-2144 | naga/src/front/spv/mod.rs:2150-2179 | naga/src/front/spv/mod.rs:2185-2206 | naga/src/front/spv/mod.rs:2212-2242 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Edited copy of a member (27 corresponding lines) · ×2
  • Edited copy of a member (27 corresponding lines) wgpu-core/src/device/resource.rs:4536 — wgpu-core/src/device/resource.rs:4536-4567 | wgpu-core/src/device/resource.rs:4691-4717 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) wgpu-core/src/command/query.rs:327 — wgpu-core/src/command/query.rs:327-353 | wgpu-core/src/command/query.rs:379-411 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (39 corresponding lines) · ×2
  • Edited copy of a member (39 corresponding lines) wgpu-core/src/command/bundle.rs:1239 — wgpu-core/src/command/bundle.rs:1239-1277 | wgpu-core/src/command/render.rs:3152-3195 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (39 corresponding lines) naga/src/back/glsl/writer.rs:4028 — naga/src/back/glsl/writer.rs:4028-4066 | naga/src/back/glsl/writer.rs:4077-4116 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (32 corresponding lines) · ×2
  • Edited copy of a member (32 corresponding lines) naga/src/back/spv/index.rs:365 — naga/src/back/spv/index.rs:365-396 | naga/src/back/spv/index.rs:422-464 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (32 corresponding lines) wgpu-core/src/command/ray_tracing_pass.rs:444 — wgpu-core/src/command/ray_tracing_pass.rs:444-475 | wgpu-core/src/command/render.rs:2217-2255 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 32+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 32+ corresponding lines) wgpu-hal/src/dx12/suballocation.rs:289 — wgpu-hal/src/dx12/suballocation.rs:289-320 | wgpu-hal/src/dx12/suballocation.rs:328-359 | wgpu-hal/src/dx12/suballocation.rs:367-399 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 32 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 32+ corresponding lines) wgpu-core/src/command/compute.rs:1182 — wgpu-core/src/command/compute.rs:1182-1213 | wgpu-core/src/command/ray_tracing_pass.rs:125-156 | wgpu-core/src/command/render.rs:3622-3653 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 32 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 20+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 20+ corresponding lines) naga/src/front/spv/mod.rs:1005 — naga/src/front/spv/mod.rs:1005-1024 | naga/src/front/spv/mod.rs:1034-1056 | naga/src/front/spv/mod.rs:1304-1327 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 20+ corresponding lines) wgpu-core/src/pipeline.rs:680 — wgpu-core/src/pipeline.rs:680-699 | wgpu-core/src/pipeline.rs:1330-1349 | wgpu-core/src/ray_tracing_pipeline.rs:349-368 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (28 corresponding lines) · ×2
  • Edited copy of a member (28 corresponding lines) deno_webgpu/device.rs:488 — deno_webgpu/device.rs:488-515 | deno_webgpu/device.rs:526-554 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) wgpu-core/src/track/buffer.rs:234 — wgpu-core/src/track/buffer.rs:234-261 | wgpu-core/src/track/texture.rs:1030-1058 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 17+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 17+ corresponding lines) wgpu-core/src/device/resource.rs:1606 — wgpu-core/src/device/resource.rs:1606-1631 | wgpu-core/src/device/resource.rs:1694-1710 | wgpu-core/src/device/resource.rs:5470-5489 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 17+ corresponding lines) wgpu-hal/src/auxil/dxgi/dxgi_lib.rs:46 — wgpu-hal/src/auxil/dxgi/dxgi_lib.rs:46-62 | wgpu-hal/src/auxil/dxgi/dxgi_lib.rs:69-90 | wgpu-hal/src/auxil/dxgi/dxgi_lib.rs:94-111 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 23+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 23+ corresponding lines) wgpu-hal/src/gles/egl.rs:1470 — wgpu-hal/src/gles/egl.rs:1470-1494 | wgpu-hal/src/gles/web.rs:464-487 | wgpu-hal/src/gles/wgl.rs:878-900 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 23 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 23+ corresponding lines) wgpu-core/src/track/buffer.rs:161 — wgpu-core/src/track/buffer.rs:161-186 | wgpu-core/src/track/buffer.rs:392-416 | wgpu-core/src/track/buffer.rs:426-448 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 23 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 10+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 10+ corresponding lines) wgpu/src/backend/wgpu_core.rs:261 — wgpu/src/backend/wgpu_core.rs:261-271 | wgpu/src/backend/wgpu_core.rs:1592-1601 | wgpu/src/backend/wgpu_core.rs:1603-1612 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 10+ corresponding lines) naga-test/src/lib.rs:70 — naga-test/src/lib.rs:70-79 | naga/src/back/hlsl/mod.rs:460-469 | naga/src/back/msl/mod.rs:460-469 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · 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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/spv/mesh_shader.rs:188` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `naga/src/back/spv/mesh_shader.rs:310` calls `decorate`, `to_words` and `naga/src/back/spv/mesh_shader.rs:230` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/spv/block.rs:935` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/glsl/builtins.rs:934` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (25 lines × 2) · ×2
  • Duplicated block (25 lines × 2) naga/src/back/msl/hoist.rs:236 — naga/src/back/msl/hoist.rs:236-260 | naga/src/valid/function.rs:825-849 — 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 (25 lines × 2) naga/src/front/spv/image.rs:859 — naga/src/front/spv/image.rs:859-883 | naga/src/front/spv/image.rs:903-927 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/spv/image.rs:859` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (19–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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (19–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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/glsl/context.rs:662` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (18–19 lines × 2) · ×2
  • Duplicated block (18–19 lines × 2) naga/src/back/msl/writer.rs:2660 — naga/src/back/msl/writer.rs:2660-2678 | naga/src/common/wgsl/to_wgsl.rs:74-91 — 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 (18–19 lines × 2) wgpu-core/src/command/transfer.rs:1309 — wgpu-core/src/command/transfer.rs:1309-1327 | wgpu-core/src/command/transfer.rs:1433-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. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/command/transfer.rs:1309` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (17–18 lines × 2) · ×2
  • 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. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/command/memory_init.rs:397` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • 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. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/track/texture.rs:1282` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wgpu-core/src/track/texture.rs:1313` calls `is_empty` and `wgpu-core/src/track/texture.rs:1280` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-hal/src/dx12/suballocation.rs:292` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-hal/src/gles/egl.rs:1478` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (12–17 lines × 2) · ×2
  • Duplicated block (12–17 lines × 2) naga/src/back/glsl/writer.rs:3756 — naga/src/back/glsl/writer.rs:3756-3767 | naga/src/back/glsl/writer.rs:3769-3785 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/glsl/writer.rs:3756` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (12–17 lines × 2) wgpu-core/src/device/resource.rs:3607 — wgpu-core/src/device/resource.rs:3607-3623 | wgpu-core/src/device/resource.rs:3724-3735 — both copies are in the same file, so extract the 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) · ×2
  • Duplicated block (17 lines × 2) naga/src/back/spv/writer.rs:2894 — naga/src/back/spv/writer.rs:2894-2910 | naga/src/back/spv/writer.rs:2926-2942 — both copies are in the same file, so extract the block into 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:1236 — naga/src/front/glsl/functions.rs:1236-1252 | naga/src/front/glsl/functions.rs:1289-1305 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/glsl/functions.rs:1236` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (15–16 lines × 2) · ×2
  • 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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/spv/next_block.rs:568` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15–16 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/track/texture.rs:579` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (12–15 lines × 2) · ×2
  • Duplicated block (12–15 lines × 2) naga/src/back/msl/writer.rs:3233 — naga/src/back/msl/writer.rs:3233-3247 | naga/src/back/msl/writer.rs:3252-3263 — both copies are in the same file, so extract the block into 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:2941 — naga/src/back/spv/block.rs:2941-2952 | naga/src/back/spv/block.rs:3907-3921 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/spv/block.rs:2941` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14–15 lines × 2) · ×2
  • Duplicated block (14–15 lines × 2) naga/src/front/spv/next_block.rs:921 — naga/src/front/spv/next_block.rs:921-934 | naga/src/front/spv/next_block.rs:1002-1016 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/spv/next_block.rs:921` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14–15 lines × 2) wgpu-hal/src/dx12/command.rs:229 — wgpu-hal/src/dx12/command.rs:229-243 | wgpu-hal/src/dx12/command.rs:255-268 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-hal/src/dx12/command.rs:229` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (13–14 lines × 2) · ×2
  • Duplicated block (13–14 lines × 2) naga/src/front/wgsl/parse/mod.rs:1414 — naga/src/front/wgsl/parse/mod.rs:1414-1427 | naga/src/front/wgsl/parse/mod.rs:1465-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 (13–14 lines × 2) wgpu-core/src/command/mod.rs:1137 — wgpu-core/src/command/mod.rs:1137-1150 | wgpu-core/src/command/mod.rs:1245-1257 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/command/mod.rs:1137` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (13 lines × 3) · ×2
  • Duplicated block (13 lines × 3) naga/src/back/glsl/writer.rs:2502 — naga/src/back/glsl/writer.rs:2502-2514 | naga/src/back/hlsl/writer.rs:4316-4328 | naga/src/back/wgsl/writer.rs:1645-1657 — `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 10 separate duplicated blocks between them, totalling at least 99 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/glsl/writer.rs:2502` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 3) naga/src/back/msl/writer.rs:5317 — naga/src/back/msl/writer.rs:5317-5329 | naga/src/back/msl/writer.rs:5525-5537 | naga/src/back/msl/writer.rs:5987-5999 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/msl/writer.rs:5317` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (7–10 lines × 2) · ×2
  • Duplicated block (7–10 lines × 2) naga/src/back/spv/block.rs:3933 — naga/src/back/spv/block.rs:3933-3942 | naga/src/back/spv/block.rs:4289-4295 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/spv/block.rs:3933` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (7–10 lines × 2) wgpu-core/src/command/bundle.rs:1051 — wgpu-core/src/command/bundle.rs:1051-1057 | wgpu-core/src/command/render.rs:2837-2846 — 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (8–9 lines × 2) · ×2
  • Duplicated block (8–9 lines × 2) naga/src/back/wgsl/writer.rs:868 — naga/src/back/wgsl/writer.rs:868-875 | naga/src/back/wgsl/writer.rs:889-897 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/wgsl/writer.rs:868` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (8–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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `naga/src/front/spv/next_block.rs:735` calls `next` and `naga/src/front/spv/next_block.rs:772` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (7–8 lines × 3) · ×2
  • Duplicated block (7–8 lines × 3) naga/src/back/glsl/writer.rs:2415 — naga/src/back/glsl/writer.rs:2415-2422 | naga/src/back/hlsl/writer.rs:3905-3911 | naga/src/back/wgsl/writer.rs:1533-1540 — `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 10 separate duplicated blocks between them, totalling at least 99 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. Note first that the copies are not typed on the same thing: the declarations holding them bind `self` to `&mut` in one and `super) fn write_literal(&mut` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (7–8 lines × 3) naga/src/front/spv/mod.rs:1465 — naga/src/front/spv/mod.rs:1465-1472 | naga/src/front/spv/next_block.rs:2838-2844 | naga/src/front/spv/next_block.rs:2898-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 5 separate duplicated blocks between them, totalling at least 46 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 (7–8 lines × 2) · ×2
  • Duplicated block (7–8 lines × 2) naga/src/front/spv/mod.rs:2756 — naga/src/front/spv/mod.rs:2756-2762 | naga/src/front/spv/mod.rs:2832-2839 — both copies are in the same file, so extract the block into 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:3356 — naga/src/front/wgsl/lower/mod.rs:3356-3362 | naga/src/front/wgsl/lower/mod.rs:3564-3571 — both copies are in the same file, so extract the 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 lines × 5) · ×2
  • Duplicated block (6 lines × 5) naga/src/front/spv/mod.rs:1464 — naga/src/front/spv/mod.rs:1464-1469 | naga/src/front/spv/next_block.rs:861-869 | naga/src/front/spv/next_block.rs:2837-2842 | naga/src/front/spv/next_block.rs:2868-2873 | naga/src/front/spv/next_block.rs:2897-2902 — 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 5 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `naga/src/front/spv/next_block.rs:2843` calls `next` and `naga/src/front/spv/next_block.rs:2874` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 5) naga/src/front/spv/mod.rs:2151 — naga/src/front/spv/mod.rs:2151-2156 | naga/src/front/spv/mod.rs:2249-2254 | naga/src/front/spv/mod.rs:2304-2309 | naga/src/front/spv/mod.rs:2374-2379 | naga/src/front/spv/mod.rs:2618-2624 — 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:2365 — naga/src/back/msl/writer.rs:2365-2370 | naga/src/back/msl/writer.rs:2611-2616 | naga/src/back/msl/writer.rs:3201-3206 | naga/src/back/msl/writer.rs:4449-4454 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/msl/writer.rs:2365` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 4) wgpu-core/src/binding_model.rs:1350 — wgpu-core/src/binding_model.rs:1350-1355 | wgpu-core/src/pipeline.rs:655-660 | wgpu-core/src/pipeline.rs:1289-1294 | wgpu-core/src/ray_tracing_pipeline.rs:309-314 — before extracting anything, compare `wgpu-core/src/pipeline.rs` and `wgpu-core/src/ray_tracing_pipeline.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 30 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 × 6) · ×2
  • Duplicated block (5 lines × 6) naga/src/back/hlsl/writer.rs:2732 — naga/src/back/hlsl/writer.rs:2732-2737 | naga/src/back/wgsl/writer.rs:920-924 | naga/src/back/wgsl/writer.rs:949-953 | naga/src/back/wgsl/writer.rs:1687-1692 | naga/src/back/wgsl/writer.rs:1761-1766 | naga/src/back/wgsl/writer.rs:1809-1813 — `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 19 separate duplicated blocks between them, totalling at least 199 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/hlsl/writer.rs:2732` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `naga/src/back/wgsl/writer.rs:918` calls `to_wgsl` and `naga/src/back/wgsl/writer.rs:947` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 6) naga/src/back/hlsl/writer.rs:4373 — naga/src/back/hlsl/writer.rs:4373-4377 | naga/src/back/wgsl/writer.rs:1241-1245 | naga/src/back/wgsl/writer.rs:1274-1278 | naga/src/back/wgsl/writer.rs:1685-1689 | naga/src/back/wgsl/writer.rs:1969-1973 | naga/src/back/wgsl/writer.rs:2058-2062 — `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 19 separate duplicated blocks between them, totalling at least 199 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.
D1 · Cyclomatic Complexity · CapabilitiesQuery · ×1
  • CapabilitiesQuery::new (cyclomatic 135) wgpu-hal/src/metal/adapter.rs:715 — CapabilitiesQuery::new has cyclomatic complexity 135 (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 · 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 · Error · ×1
  • Error::as_parse_error (cyclomatic 125) naga/src/front/wgsl/error.rs:680 — Error::as_parse_error has cyclomatic complexity 125 (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:1795 — 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 103) naga/src/proc/typifier.rs:265 — ResolveContext::resolve has cyclomatic complexity 103 (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 79) naga/src/back/dot/mod.rs:65 — StatementGraph::add has cyclomatic complexity 79 (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:1907 — 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 57) player/src/lib.rs:105 — Player::process has cyclomatic complexity 57 (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 · PhysicalDeviceProperties · ×1
  • PhysicalDeviceProperties::get_required_extensions (cyclomatic 48) wgpu-hal/src/vulkan/adapter.rs:1232 — 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 · Texture · ×1
  • Texture::create_view_inner (cyclomatic 45) wgpu-core/src/resource.rs:2108 — Texture::create_view_inner has cyclomatic complexity 45 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
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 44) naga/src/back/msl/mod.rs:650 — ResolvedBinding::try_fmt 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.
D1 · Cyclomatic Complexity · MacroCall · ×1
  • MacroCall::call (cyclomatic 43) naga/src/front/glsl/builtins.rs:1588 — MacroCall::call has cyclomatic complexity 43 (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 · ExpressionTracer · ×1
  • ExpressionTracer::trace_expression (cyclomatic 36) naga/src/compact/expressions.rs:76 — ExpressionTracer::trace_expression 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.
D1 · Cyclomatic Complexity · FunctionTracer · ×1
  • FunctionTracer::trace_block_impl (cyclomatic 36) naga/src/compact/statements.rs:30 — FunctionTracer::trace_block_impl has cyclomatic complexity 36 (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 · TypeContext · ×1
  • TypeContext::fmt (cyclomatic 35) naga/src/back/msl/writer.rs:220 — TypeContext::fmt 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: 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 · FunctionMap · ×1
  • FunctionMap::adjust_body (cyclomatic 35) naga/src/compact/statements.rs:309 — FunctionMap::adjust_body has cyclomatic complexity 35 (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 · 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 · 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 21) wgpu-core/src/resource.rs:861 — Buffer::try_map_async 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.
D1 · Cyclomatic Complexity · CoreDevice · ×1
  • CoreDevice::create_bind_group (cyclomatic 19) wgpu/src/backend/wgpu_core.rs:1077 — 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 · CommandBufferMutable · ×1
  • CommandBufferMutable::validate_acceleration_structure_actions (cyclomatic 19) wgpu-core/src/command/ray_tracing.rs:534 — CommandBufferMutable::validate_acceleration_structure_actions 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 · WebCommandEncoder · ×1
  • WebCommandEncoder::begin_render_pass (cyclomatic 18) wgpu/src/backend/webgpu.rs:3501 — WebCommandEncoder::begin_render_pass has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: 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 · Options · ×1
  • Options::resolve_local_binding (cyclomatic 17) naga/src/back/msl/mod.rs:472 — 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 · 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.
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 160) wgpu-hal/src/metal/adapter.rs:715 — CapabilitiesQuery::new has cognitive complexity 160 (threshold 15). Drivers by points: if/else 79 (81 pts), boolean chains 77, 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:1907 — 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 88) naga/src/proc/typifier.rs:265 — ResolveContext::resolve has cognitive complexity 88 (threshold 15). Drivers by points: match/switch 23 (56 pts), if/else 13 (32 pts) (nesting depth added 52). 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 83) naga/src/back/dot/mod.rs:65 — StatementGraph::add has cognitive complexity 83 (threshold 15). Drivers by points: if/else 17 (42 pts), match/switch 9 (28 pts), loops 5 (13 pts) (nesting depth added 52). To reduce it, split the body into named stages: move each independent 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 · CommandBufferMutable · ×1
  • CommandBufferMutable::validate_acceleration_structure_actions (cognitive 59) wgpu-core/src/command/ray_tracing.rs:534 — CommandBufferMutable::validate_acceleration_structure_actions has cognitive complexity 59 (threshold 15). Drivers by points: if/else 8 (32 pts), loops 6 (17 pts), match/switch 3 (10 pts) (nesting depth added 42). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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 · FunctionTracer · ×1
  • FunctionTracer::trace_block_impl (cognitive 54) naga/src/compact/statements.rs:30 — FunctionTracer::trace_block_impl has cognitive complexity 54 (threshold 15). Drivers by points: if/else 7 (28 pts), loops 5 (15 pts), match/switch 3 (11 pts) (nesting depth added 39). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PhysicalDeviceProperties · ×1
  • PhysicalDeviceProperties::get_required_extensions (cognitive 53) wgpu-hal/src/vulkan/adapter.rs:1232 — 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 · FunctionMap · ×1
  • FunctionMap::adjust_body (cognitive 50) naga/src/compact/statements.rs:309 — 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.
D2 · Cognitive Complexity · MacroCall · ×1
  • MacroCall::call (cognitive 49) naga/src/front/glsl/builtins.rs:1588 — MacroCall::call has cognitive complexity 49 (threshold 15). Drivers by points: match/switch 10 (25 pts), if/else 10 (20 pts), loops 1 (4 pts) (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.
D2 · Cognitive Complexity · Texture · ×1
  • Texture::create_view_inner (cognitive 47) wgpu-core/src/resource.rs:2108 — Texture::create_view_inner has cognitive complexity 47 (threshold 15). Drivers by points: if/else 29 (32 pts), boolean chains 9, match/switch 5 (6 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
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 · 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:680 — 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 26) wgpu-core/src/resource.rs:861 — Buffer::try_map_async has cognitive complexity 26 (threshold 15). Drivers by points: if/else 17 (20 pts), match/switch 4 (5 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 · WebCommandEncoder · ×1
  • WebCommandEncoder::begin_render_pass (cognitive 24) wgpu/src/backend/webgpu.rs:3501 — WebCommandEncoder::begin_render_pass has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (17 pts), match/switch 4 (7 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 · deno_webgpu · ×1
  • deno_webgpu::get_data_slice (cognitive 22) deno_webgpu/lib.rs:379 — 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:417 — 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 · CoreDevice · ×1
  • CoreDevice::create_bind_group (cognitive 22) wgpu/src/backend/wgpu_core.rs:1077 — 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:472 — 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:481 — 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:216 — 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:105 — 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:1089 — 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.
D35 · Change Coupling · Change coupling · ×1
  • 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 59% of the time (30 of the 51 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 30 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.
D4 · Code Duplication · Near-duplicate member pair (108 shared lines) · ×1
  • Near-duplicate member pair (108 shared lines) wgpu-core/src/command/compute.rs:626 — wgpu-core/src/command/compute.rs:626-912 | wgpu-core/src/command/ray_tracing_pass.rs:674-861 — These two members are variants of one another: 108 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Members sharing a duplicated core (7 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (7 members, 50+ identical tokens) naga/src/back/dot/mod.rs:65 — naga/src/back/dot/mod.rs:65-494 | naga/src/back/glsl/writer.rs:1630-2309 | naga/src/back/msl/writer.rs:4138-4685 | naga/src/back/wgsl/writer.rs:756-1321 | naga/src/valid/analyzer.rs:901-1284 | naga/src/valid/function.rs:753-809 | naga/src/valid/handles.rs:698-953 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
D4 · Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (5 members, 50+ identical tokens) naga/src/front/spv/mod.rs:2150 — naga/src/front/spv/mod.rs:2150-2179 | naga/src/front/spv/mod.rs:2248-2281 | naga/src/front/spv/mod.rs:2303-2367 | naga/src/front/spv/mod.rs:2373-2454 | naga/src/front/spv/mod.rs:2617-2707 — 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 · Edited copy of a member (113 corresponding lines) · ×1
  • Edited copy of a member (113 corresponding lines) wgpu-core/src/command/transfer.rs:1224 — wgpu-core/src/command/transfer.rs:1224-1336 | wgpu-core/src/command/transfer.rs:1343-1462 — These two members are one piece of code written twice and then edited apart: 113 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (79 corresponding lines) · ×1
  • Edited copy of a member (79 corresponding lines) wgpu/src/backend/wgpu_core.rs:1255 — wgpu/src/backend/wgpu_core.rs:1255-1335 | wgpu/src/backend/wgpu_core.rs:1340-1418 — These two members are one piece of code written twice and then edited apart: 79 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 66+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 66+ corresponding lines) deno_webgpu/compute_pass.rs:126 — deno_webgpu/compute_pass.rs:126-191 | deno_webgpu/render_bundle.rs:117-185 | deno_webgpu/render_pass.rs:181-247 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 66 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (68 corresponding lines) · ×1
  • Edited copy of a member (68 corresponding lines) wgpu-core/src/command/bundle.rs:1078 — wgpu-core/src/command/bundle.rs:1078-1145 | wgpu-core/src/command/render.rs:2880-2960 — These two members are one piece of code written twice and then edited apart: 68 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (62 corresponding lines) · ×1
  • Edited copy of a member (62 corresponding lines) naga/src/front/glsl/functions.rs:1032 — naga/src/front/glsl/functions.rs:1032-1115 | naga/src/front/glsl/functions.rs:1123-1184 — These two members are one piece of code written twice and then edited apart: 62 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (81 corresponding lines) · ×1
  • Edited copy of a member (81 corresponding lines) wgpu-core/src/command/compute.rs:476 — wgpu-core/src/command/compute.rs:476-559 | wgpu-core/src/command/ray_tracing_pass.rs:576-656 — These two members are one piece of code written twice and then edited apart: 81 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (67 corresponding lines) · ×1
  • Edited copy of a member (67 corresponding lines) wgpu-core/src/resource.rs:1298 — wgpu-core/src/resource.rs:1298-1369 | wgpu-core/src/resource.rs:2040-2106 — These two members are one piece of code written twice and then edited apart: 67 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (54 corresponding lines) · ×1
  • Edited copy of a member (54 corresponding lines) naga/src/front/spv/mod.rs:1121 — naga/src/front/spv/mod.rs:1121-1174 | naga/src/front/spv/mod.rs:1189-1244 — These two members are one piece of code written twice and then edited apart: 54 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (63 corresponding lines) · ×1
  • Edited copy of a member (63 corresponding lines) wgpu-hal/src/dx12/view.rs:228 — wgpu-hal/src/dx12/view.rs:228-290 | wgpu-hal/src/dx12/view.rs:296-367 — These two members are one piece of code written twice and then edited apart: 63 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 55+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 55+ corresponding lines) deno_webgpu/webidl.rs:43 — deno_webgpu/webidl.rs:43-99 | deno_webgpu/webidl.rs:153-209 | deno_webgpu/webidl.rs:248-302 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 55 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 44+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 44+ corresponding lines) naga/src/back/hlsl/help.rs:1107 — naga/src/back/hlsl/help.rs:1107-1150 | naga/src/back/hlsl/help.rs:1167-1228 | naga/src/back/hlsl/help.rs:1245-1305 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 44 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 1+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 1+ corresponding lines) wgpu-types/src/binding.rs:196 — wgpu-types/src/binding.rs:196-196 | wgpu-types/src/buffer.rs:47-47 | wgpu-types/src/features.rs:216-216 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 1 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (38 corresponding lines) · ×1
  • Edited copy of a member (38 corresponding lines) naga/src/front/spv/image.rs:838 — naga/src/front/spv/image.rs:838-883 | naga/src/front/spv/image.rs:890-927 — These two members are one piece of code written twice and then edited apart: 38 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (40 corresponding lines) · ×1
  • Edited copy of a member (40 corresponding lines) wgpu-core/src/command/bundle.rs:1898 — wgpu-core/src/command/bundle.rs:1898-1937 | wgpu-core/src/command/render.rs:671-721 — These two members are one piece of code written twice and then edited apart: 40 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (36 corresponding lines) · ×1
  • Edited copy of a member (36 corresponding lines) naga/src/front/spv/mod.rs:1068 — naga/src/front/spv/mod.rs:1068-1103 | naga/src/front/spv/mod.rs:1254-1294 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (46 corresponding lines) · ×1
  • Edited copy of a member (46 corresponding lines) naga/src/back/hlsl/writer.rs:5288 — naga/src/back/hlsl/writer.rs:5288-5335 | naga/src/back/hlsl/writer.rs:5346-5391 — These two members are one piece of code written twice and then edited apart: 46 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (35 corresponding lines) · ×1
  • Edited copy of a member (35 corresponding lines) wgpu-hal/src/dx12/suballocation.rs:460 — wgpu-hal/src/dx12/suballocation.rs:460-497 | wgpu-hal/src/dx12/suballocation.rs:503-537 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 30+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 30+ corresponding lines) wgpu-core/src/command/transfer.rs:910 — wgpu-core/src/command/transfer.rs:910-939 | wgpu-core/src/command/transfer.rs:961-990 | wgpu-core/src/command/transfer.rs:1012-1043 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 30 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 28+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 28+ corresponding lines) wgpu-core/src/track/texture.rs:577 — wgpu-core/src/track/texture.rs:577-608 | wgpu-core/src/track/texture.rs:618-645 | wgpu-core/src/track/texture.rs:668-703 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 28 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 48+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 48+ corresponding lines) naga/src/back/hlsl/mod.rs:813 — naga/src/back/hlsl/mod.rs:813-860 | naga/src/back/msl/mod.rs:849-896 | naga/src/back/spv/mod.rs:1194-1244 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 48 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 33+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 33+ corresponding lines) wgpu-hal/src/dx12/command.rs:1547 — wgpu-hal/src/dx12/command.rs:1547-1580 | wgpu-hal/src/dx12/command.rs:1586-1619 | wgpu-hal/src/dx12/command.rs:1747-1779 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 33 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 20+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 20+ corresponding lines) wgpu-core/src/pipeline.rs:103 — wgpu-core/src/pipeline.rs:103-124 | wgpu-core/src/pipeline.rs:610-631 | wgpu-core/src/pipeline.rs:1244-1265 | wgpu-core/src/resource.rs:3503-3522 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (25 corresponding lines) · ×1
  • Edited copy of a member (25 corresponding lines) wgpu-core/src/command/mod.rs:330 — wgpu-core/src/command/mod.rs:330-354 | wgpu-core/src/command/mod.rs:365-391 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 27+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 27+ corresponding lines) wgpu-core/src/track/buffer.rs:665 — wgpu-core/src/track/buffer.rs:665-691 | wgpu-core/src/track/texture.rs:830-865 | wgpu-core/src/track/texture.rs:875-905 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 27 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 21+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 21+ corresponding lines) wgpu-hal/src/vulkan/instance.rs:481 — wgpu-hal/src/vulkan/instance.rs:481-506 | wgpu-hal/src/vulkan/instance.rs:512-536 | wgpu-hal/src/vulkan/instance.rs:542-564 | wgpu-hal/src/vulkan/instance.rs:569-590 | wgpu-hal/src/vulkan/instance.rs:721-741 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 21 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (37 corresponding lines) · ×1
  • Edited copy of a member (37 corresponding lines) naga/src/back/hlsl/help.rs:314 — naga/src/back/hlsl/help.rs:314-354 | naga/src/back/msl/writer.rs:6542-6578 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 18+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 18+ corresponding lines) wgpu-core/src/device/resource.rs:2260 — wgpu-core/src/device/resource.rs:2260-2282 | wgpu-core/src/device/resource.rs:2443-2460 | wgpu-core/src/device/resource.rs:3036-3064 | wgpu-core/src/device/resource.rs:4338-4359 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (34 corresponding lines) · ×1
  • Edited copy of a member (34 corresponding lines) wgpu-core/src/command/bundle.rs:1199 — wgpu-core/src/command/bundle.rs:1199-1232 | wgpu-core/src/command/render.rs:3111-3145 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (22 corresponding lines) · ×1
  • Edited copy of a member (22 corresponding lines) wgpu-hal/src/gles/command.rs:1103 — wgpu-hal/src/gles/command.rs:1103-1124 | wgpu-hal/src/gles/command.rs:1160-1181 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (29 corresponding lines) · ×1
  • Edited copy of a member (29 corresponding lines) wgpu-core/src/command/compute.rs:918 — wgpu-core/src/command/compute.rs:918-946 | wgpu-core/src/command/ray_tracing_pass.rs:867-895 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 21+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 21+ corresponding lines) wgpu-core/src/command/render.rs:4218 — wgpu-core/src/command/render.rs:4218-4238 | wgpu-core/src/command/render.rs:4267-4288 | wgpu-core/src/command/render.rs:4320-4341 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 21 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 15+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 15+ corresponding lines) naga/src/back/glsl/writer.rs:4501 — naga/src/back/glsl/writer.rs:4501-4515 | naga/src/back/hlsl/writer.rs:5079-5093 | naga/src/back/hlsl/writer.rs:5099-5113 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (6 members, 21+ corresponding lines) · ×1
  • Edited copies of one member (6 members, 21+ corresponding lines) wgpu-core/src/command/render.rs:4001 — wgpu-core/src/command/render.rs:4001-4021 | wgpu-core/src/command/render.rs:4034-4054 | wgpu-core/src/command/render.rs:4067-4087 | wgpu-core/src/command/render.rs:4101-4121 | wgpu-core/src/command/render.rs:4135-4155 | wgpu-core/src/command/render.rs:4174-4194 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 21 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 11+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 11+ corresponding lines) wgpu-core/src/command/clear.rs:95 — wgpu-core/src/command/clear.rs:95-113 | wgpu-core/src/command/draw.rs:147-172 | wgpu-core/src/command/query.rs:164-174 | wgpu-core/src/ray_tracing.rs:217-253 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 14+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 14+ corresponding lines) naga/src/common/diagnostic_debug.rs:22 — naga/src/common/diagnostic_debug.rs:22-35 | naga/src/common/diagnostic_debug.rs:39-52 | naga/src/common/diagnostic_display.rs:77-90 | naga/src/common/diagnostic_display.rs:94-107 | naga/src/proc/overloads/rule.rs:129-145 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 15+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 15+ corresponding lines) wgpu-core/src/command/bundle.rs:727 — wgpu-core/src/command/bundle.rs:727-741 | wgpu-core/src/command/compute.rs:1260-1279 | wgpu-core/src/command/ray_tracing_pass.rs:158-177 | wgpu-core/src/command/render.rs:3859-3878 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (20 corresponding lines) · ×1
  • Edited copy of a member (20 corresponding lines) naga/src/front/glsl/ast.rs:266 — naga/src/front/glsl/ast.rs:266-285 | naga/src/front/glsl/ast.rs:289-308 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 9+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 9+ corresponding lines) wgpu-core/src/present.rs:298 — wgpu-core/src/present.rs:298-306 | wgpu-core/src/present.rs:407-415 | wgpu-core/src/present.rs:454-462 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 13+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 13+ corresponding lines) wgpu-hal/src/dx12/mod.rs:440 — wgpu-hal/src/dx12/mod.rs:440-452 | wgpu-hal/src/dx12/mod.rs:457-471 | wgpu-hal/src/dx12/mod.rs:476-489 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 19+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 19+ corresponding lines) wgpu-core/src/command/compute.rs:1230 — wgpu-core/src/command/compute.rs:1230-1251 | wgpu-core/src/command/ray_tracing_pass.rs:424-443 | wgpu-core/src/command/render.rs:3667-3685 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 19 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 14+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 14+ corresponding lines) wgpu-hal/src/gles/command.rs:398 — wgpu-hal/src/gles/command.rs:398-411 | wgpu-hal/src/gles/command.rs:420-434 | wgpu-hal/src/gles/command.rs:444-457 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (6 members, 13+ corresponding lines) · ×1
  • Edited copies of one member (6 members, 13+ corresponding lines) wgpu-core/src/command/compute.rs:1338 — wgpu-core/src/command/compute.rs:1338-1350 | wgpu-core/src/command/compute.rs:1374-1386 | wgpu-core/src/command/ray_tracing_pass.rs:488-500 | wgpu-core/src/command/ray_tracing_pass.rs:528-540 | wgpu-core/src/command/render.rs:4366-4378 | wgpu-core/src/command/render.rs:4402-4414 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 12+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 12+ corresponding lines) wgpu-core/src/command/bundle.rs:820 — wgpu-core/src/command/bundle.rs:820-831 | wgpu-core/src/command/query.rs:482-493 | wgpu-core/src/command/render.rs:3957-3968 | wgpu-core/src/command/transfer.rs:889-903 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 8+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 8+ corresponding lines) wgpu-core/src/command/compute.rs:564 — wgpu-core/src/command/compute.rs:564-571 | wgpu-core/src/command/mod.rs:1409-1416 | wgpu-core/src/command/ray_tracing_pass.rs:661-668 | wgpu-core/src/command/render.rs:2206-2213 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 4+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 4+ corresponding lines) naga/src/arena/mod.rs:275 — naga/src/arena/mod.rs:275-280 | naga/src/arena/unique_arena.rs:228-233 | naga/src/ir/block.rs:25-28 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (3 corresponding lines) · ×1
  • Edited copy of a member (3 corresponding lines) naga/src/proc/overloads/constructor_set.rs:68 — naga/src/proc/overloads/constructor_set.rs:68-70 | naga/src/proc/overloads/scalar_set.rs:105-107 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 5+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 5+ corresponding lines) wgpu-core/src/device/stage_compiler.rs:92 — wgpu-core/src/device/stage_compiler.rs:92-96 | wgpu-core/src/ray_tracing_pipeline.rs:229-235 | wgpu-core/src/resource.rs:1656-1661 | wgpu-core/src/scratch.rs:39-44 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 6+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 6+ corresponding lines) wgpu-core/src/command/bundle.rs:919 — wgpu-core/src/command/bundle.rs:919-924 | wgpu-core/src/command/compute.rs:1367-1372 | wgpu-core/src/command/mod.rs:1837-1842 | wgpu-core/src/command/ray_tracing_pass.rs:517-522 | wgpu-core/src/command/render.rs:4395-4400 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/glsl/context.rs:840` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `naga/src/front/glsl/context.rs:919` calls `Scalar` and `naga/src/front/glsl/context.rs:839` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (44–45 lines × 2) · ×1
  • Duplicated block (44–45 lines × 2) wgpu-core/src/command/compute.rs:627 — wgpu-core/src/command/compute.rs:627-670 | wgpu-core/src/command/ray_tracing_pass.rs:675-719 — before extracting anything, compare `wgpu-core/src/command/compute.rs` and `wgpu-core/src/command/ray_tracing_pass.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 180 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/command/compute.rs:627` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (45 lines × 2) · ×1
  • Duplicated block (45 lines × 2) wgpu-core/src/command/compute.rs:868 — wgpu-core/src/command/compute.rs:868-912 | wgpu-core/src/command/ray_tracing_pass.rs:817-861 — before extracting anything, compare `wgpu-core/src/command/compute.rs` and `wgpu-core/src/command/ray_tracing_pass.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 180 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/command/compute.rs:868` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (44 lines × 2) · ×1
  • Duplicated block (44 lines × 2) naga/src/back/glsl/writer.rs:2194 — naga/src/back/glsl/writer.rs:2194-2237 | naga/src/back/wgsl/writer.rs:1117-1160 — `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 10 separate duplicated blocks between them, totalling at least 141 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 (38 lines × 2) · ×1
  • Duplicated block (38 lines × 2) naga/src/front/spv/next_block.rs:1119 — naga/src/front/spv/next_block.rs:1119-1156 | naga/src/front/spv/next_block.rs:1185-1222 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/spv/next_block.rs:1119` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
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 (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. Read the line range as the matched WINDOW rather than a finished unit: at `deno_webgpu/compute_pass.rs:127` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `deno_webgpu/render_bundle.rs:118` calls `borrow_mut`, `as_mut` and `deno_webgpu/compute_pass.rs:126` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/glsl/builtins.rs:974` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (32 lines × 2) · ×1
  • Duplicated block (32 lines × 2) wgpu-core/src/device/queue.rs:1205 — wgpu-core/src/device/queue.rs:1205-1236 | wgpu-core/src/device/queue.rs:1491-1522 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/device/queue.rs:1205` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (28 lines × 2) · ×1
  • Duplicated block (28 lines × 2) naga/src/front/spv/next_block.rs:938 — naga/src/front/spv/next_block.rs:938-965 | naga/src/front/spv/next_block.rs:1013-1040 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/spv/next_block.rs:938` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (26–27 lines × 2) · ×1
  • Duplicated block (26–27 lines × 2) 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:3977 — naga/src/back/hlsl/writer.rs:3977-3994 | naga/src/back/wgsl/writer.rs:1575-1600 — `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 19 separate duplicated blocks between them, totalling at least 199 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/hlsl/writer.rs:3977` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (26 lines × 2) · ×1
  • Duplicated block (26 lines × 2) wgpu-core/src/command/bundle.rs:1113 — wgpu-core/src/command/bundle.rs:1113-1138 | wgpu-core/src/command/render.rs:2928-2953 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/command/bundle.rs:1113` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (23–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. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/command/query.rs:331` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (21–24 lines × 2) · ×1
  • Duplicated block (21–24 lines × 2) naga/src/back/msl/writer.rs:6193 — naga/src/back/msl/writer.rs:6193-6216 | naga/src/back/msl/writer.rs:6283-6303 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/msl/writer.rs:6193` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (22–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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/glsl/context.rs:668` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `naga/src/front/glsl/context.rs:870` calls `with_capacity` and `naga/src/front/glsl/context.rs:667` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (22 lines × 3) · ×1
  • Duplicated block (22 lines × 3) wgpu-core/src/command/compute.rs:1183 — wgpu-core/src/command/compute.rs:1183-1204 | wgpu-core/src/command/ray_tracing_pass.rs:126-147 | wgpu-core/src/command/render.rs:3623-3644 — before extracting anything, compare `wgpu-core/src/command/compute.rs` and `wgpu-core/src/command/ray_tracing_pass.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 180 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 (20–22 lines × 2) · ×1
  • Duplicated block (20–22 lines × 2) naga/src/back/spv/writer.rs:1450 — naga/src/back/spv/writer.rs:1450-1469 | naga/src/back/spv/writer.rs:1482-1503 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/spv/writer.rs:1482` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (15–21 lines × 2) · ×1
  • Duplicated block (15–21 lines × 2) naga/src/back/msl/writer.rs:6177 — naga/src/back/msl/writer.rs:6177-6191 | naga/src/back/msl/writer.rs:6261-6281 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/msl/writer.rs:6177` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (18–20 lines × 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 × 3) · ×1
  • Duplicated block (18–19 lines × 3) naga/src/proc/constant_evaluator.rs:2898 — naga/src/proc/constant_evaluator.rs:2898-2915 | naga/src/proc/constant_evaluator.rs:2961-2978 | naga/src/proc/constant_evaluator.rs:3064-3082 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/proc/constant_evaluator.rs:3064` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (18 lines × 3) · ×1
  • Duplicated block (18 lines × 3) naga/src/front/spv/next_block.rs:2673 — naga/src/front/spv/next_block.rs:2673-2690 | naga/src/front/spv/next_block.rs:2754-2771 | naga/src/front/spv/next_block.rs:2809-2826 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/spv/next_block.rs:2673` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `naga/src/front/spv/next_block.rs:2828` calls `QuadSwap` and `naga/src/front/spv/next_block.rs:2692` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (16–18 lines × 2) · ×1
  • Duplicated block (16–18 lines × 2) naga/src/back/spv/image.rs:916 — naga/src/back/spv/image.rs:916-933 | naga/src/back/spv/image.rs:936-951 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/spv/image.rs:916` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (16–17 lines × 2) · ×1
  • Duplicated block (16–17 lines × 2) wgpu-core/src/device/resource.rs:920 — wgpu-core/src/device/resource.rs:920-935 | wgpu-core/src/device/resource.rs:941-957 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/device/resource.rs:920` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (16 lines × 3) · ×1
  • Duplicated block (16 lines × 3) wgpu/src/backend/webgpu.rs:3769 — wgpu/src/backend/webgpu.rs:3769-3784 | wgpu/src/backend/webgpu.rs:3865-3880 | wgpu/src/backend/webgpu.rs:4189-4204 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (12–16 lines × 2) · ×1
  • Duplicated block (12–16 lines × 2) naga/src/back/wgsl/writer.rs:2114 — naga/src/back/wgsl/writer.rs:2114-2129 | naga/src/back/wgsl/writer.rs:2171-2182 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/wgsl/writer.rs:2114` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14–15 lines × 3) · ×1
  • Duplicated block (14–15 lines × 3) naga/src/back/hlsl/help.rs:1464 — naga/src/back/hlsl/help.rs:1464-1478 | naga/src/back/hlsl/help.rs:1506-1520 | naga/src/back/hlsl/help.rs:1575-1588 — 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:2130 — naga/src/front/spv/mod.rs:2130-2144 | naga/src/front/spv/mod.rs:2165-2179 | naga/src/front/spv/mod.rs:2192-2206 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/spv/mod.rs:2130` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (23–26 lines × 2) · ×1
  • Duplicated block (23–26 lines × 2) wgpu-core/src/indirect_validation/dispatch.rs:186 — wgpu-core/src/indirect_validation/dispatch.rs:186-208 | wgpu-core/src/indirect_validation/draw.rs:119-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 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. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/indirect_validation/dispatch.rs:186` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (14 lines × 3) · ×1
  • Duplicated block (14 lines × 3) naga/src/front/wgsl/lower/mod.rs:3826 — naga/src/front/wgsl/lower/mod.rs:3826-3839 | naga/src/front/wgsl/lower/mod.rs:3849-3862 | naga/src/front/wgsl/lower/mod.rs:3872-3885 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/wgsl/lower/mod.rs:3826` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (13 lines × 4) · ×1
  • Duplicated block (13 lines × 4) naga/src/back/spv/ray/mod.rs:148 — naga/src/back/spv/ray/mod.rs:148-160 | naga/src/back/spv/ray/mod.rs:163-175 | naga/src/back/spv/ray/mod.rs:196-208 | naga/src/back/spv/ray/mod.rs:211-223 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/spv/ray/mod.rs:148` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/wgsl/parse/number.rs:188` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `naga/src/front/wgsl/parse/number.rs:213` calls `end`, `start` and `naga/src/front/wgsl/parse/number.rs:186` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (12–13 lines × 3) · ×1
  • Duplicated block (12–13 lines × 3) wgpu-core/src/command/render.rs:4222 — wgpu-core/src/command/render.rs:4222-4233 | wgpu-core/src/command/render.rs:4271-4283 | wgpu-core/src/command/render.rs:4324-4336 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/command/render.rs:4222` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (12–13 lines × 2) · ×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:2867 — naga/src/front/spv/mod.rs:2867-2878 | naga/src/front/spv/mod.rs:2890-2900 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/spv/mod.rs:2890` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-hal/src/gles/queue.rs:499` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
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. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-hal/src/gles/queue.rs:627` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (9–11 lines × 3) · ×1
  • Duplicated block (9–11 lines × 3) naga/src/back/hlsl/writer.rs:3669 — naga/src/back/hlsl/writer.rs:3669-3677 | naga/src/back/wgsl/writer.rs:1689-1699 | naga/src/back/wgsl/writer.rs:1763-1773 — `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 19 separate duplicated blocks between them, totalling at least 199 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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/glsl/parser.rs:380` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (8–11 lines × 3) · ×1
  • Duplicated block (8–11 lines × 3) naga/src/front/spv/next_block.rs:967 — naga/src/front/spv/next_block.rs:967-977 | naga/src/front/spv/next_block.rs:1101-1109 | naga/src/front/spv/next_block.rs:2961-2968 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/spv/mesh_shader.rs:447` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `naga/src/back/spv/mesh_shader.rs:459` calls `get_bool_type_id` and `naga/src/back/spv/mesh_shader.rs:481` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8–11 lines × 2) · ×1
  • Duplicated block (8–11 lines × 2) wgpu/src/backend/wgpu_core.rs:2184 — wgpu/src/backend/wgpu_core.rs:2184-2194 | wgpu/src/backend/wgpu_core.rs:2236-2243 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. Note first that the copies are not typed on the same thing: the declarations holding them bind `desc` to `&crate::ComputePassDescriptor<'_>` in one and `&crate::RenderPassDescriptor<'_>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
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:1076-1081 | naga/src/front/spv/next_block.rs:1108-1113 | naga/src/front/spv/next_block.rs:1176-1181 | naga/src/front/spv/next_block.rs:1269-1274 | naga/src/front/spv/next_block.rs:1483-1489 | naga/src/front/spv/next_block.rs:2362-2371 | naga/src/front/spv/next_block.rs:2713-2719 | naga/src/front/spv/next_block.rs:2784-2790 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `naga/src/front/spv/next_block.rs:469` calls `lookup` and `naga/src/front/spv/next_block.rs:1082` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (6–10 lines × 5) · ×1
  • Duplicated block (6–10 lines × 5) naga/src/front/spv/mod.rs:1070 — naga/src/front/spv/mod.rs:1070-1075 | naga/src/front/spv/mod.rs:1124-1129 | naga/src/front/spv/mod.rs:1192-1197 | naga/src/front/spv/mod.rs:1257-1263 | naga/src/front/spv/next_block.rs:867-876 — 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 5 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/spv/next_block.rs:867` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `naga/src/front/spv/mod.rs:1123` calls `next` and `naga/src/front/spv/mod.rs:1069` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (10 lines × 4) · ×1
  • Duplicated block (10 lines × 4) naga/src/front/spv/mod.rs:2130 — naga/src/front/spv/mod.rs:2130-2139 | naga/src/front/spv/mod.rs:2165-2174 | naga/src/front/spv/mod.rs:2192-2201 | naga/src/front/spv/mod.rs:2228-2237 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/spv/mod.rs:2130` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8–10 lines × 3) · ×1
  • Duplicated block (8–10 lines × 3) naga/src/back/glsl/writer.rs:848 — naga/src/back/glsl/writer.rs:848-855 | naga/src/back/hlsl/writer.rs:245-252 | naga/src/back/msl/writer.rs:3817-3826 — `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 10 separate duplicated blocks between them, totalling at least 99 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/glsl/writer.rs:848` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (6–10 lines × 2) · ×1
  • Duplicated block (6–10 lines × 2) naga/src/front/spv/mod.rs:1036 — naga/src/front/spv/mod.rs:1036-1041 | naga/src/front/spv/next_block.rs:974-983 — 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 5 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/spv/next_block.rs:974` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (4–10 lines × 4) · ×1
  • Duplicated block (4–10 lines × 4) naga/src/front/spv/next_block.rs:2539 — naga/src/front/spv/next_block.rs:2539-2542 | naga/src/front/spv/next_block.rs:2634-2643 | naga/src/front/spv/next_block.rs:2721-2724 | naga/src/front/spv/next_block.rs:2787-2796 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `naga/src/front/spv/next_block.rs:2718` calls `lookup` and `naga/src/front/spv/next_block.rs:2537` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (9–10 lines × 2) · ×1
  • Duplicated block (9–10 lines × 2) naga/src/valid/function.rs:1582 — naga/src/valid/function.rs:1582-1591 | naga/src/valid/function.rs:2041-2049 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (7–9 lines × 3) · ×1
  • Duplicated block (7–9 lines × 3) naga/src/back/hlsl/help.rs:1130 — naga/src/back/hlsl/help.rs:1130-1136 | naga/src/back/hlsl/help.rs:1204-1212 | naga/src/back/hlsl/help.rs:1281-1289 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/hlsl/help.rs:1130` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `self` to `super) fn write_wrapped_struct_matrix_set_function( &mut` in one and `super) fn write_wrapped_struct_matrix_set_vec_function( &mut` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (7–9 lines × 2) · ×1
  • Duplicated block (7–9 lines × 2) naga/src/front/spv/mod.rs:1468 — naga/src/front/spv/mod.rs:1468-1474 | naga/src/front/spv/next_block.rs:2900-2908 — 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 5 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/spv/next_block.rs:2900` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `naga/src/front/spv/mod.rs:1466` calls `next` and `naga/src/front/spv/next_block.rs:2898` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (6–9 lines × 3) · ×1
  • Duplicated block (6–9 lines × 3) naga/src/front/wgsl/lower/mod.rs:3703 — naga/src/front/wgsl/lower/mod.rs:3703-3711 | naga/src/front/wgsl/lower/mod.rs:3718-3726 | naga/src/front/wgsl/lower/mod.rs:3732-3737 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/wgsl/lower/mod.rs:3703` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `naga/src/front/wgsl/lower/mod.rs:3703` calls `prepare_args` and `naga/src/front/wgsl/lower/mod.rs:3732` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (7–8 lines × 5) · ×1
  • Duplicated block (7–8 lines × 5) naga/src/back/wgsl/writer.rs:920 — naga/src/back/wgsl/writer.rs:920-926 | naga/src/back/wgsl/writer.rs:949-955 | naga/src/back/wgsl/writer.rs:1687-1694 | naga/src/back/wgsl/writer.rs:1761-1768 | naga/src/back/wgsl/writer.rs:1809-1815 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `naga/src/back/wgsl/writer.rs:918` calls `to_wgsl` and `naga/src/back/wgsl/writer.rs:947` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (7–8 lines × 4) · ×1
  • Duplicated block (7–8 lines × 4) naga/src/front/spv/next_block.rs:1050 — naga/src/front/spv/next_block.rs:1050-1056 | naga/src/front/spv/next_block.rs:1239-1245 | naga/src/front/spv/next_block.rs:1881-1888 | naga/src/front/spv/next_block.rs:2515-2521 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/spv/next_block.rs:1881` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8 lines × 3) · ×1
  • 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. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-hal/src/gles/egl.rs:1416` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (4–8 lines × 3) · ×1
  • Duplicated block (4–8 lines × 3) naga/src/back/glsl/writer.rs:2169 — naga/src/back/glsl/writer.rs:2169-2172 | naga/src/back/glsl/writer.rs:2185-2192 | naga/src/back/glsl/writer.rs:2242-2249 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/glsl/writer.rs:2185` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6–8 lines × 2) · ×1
  • Duplicated block (6–8 lines × 2) naga/src/front/wgsl/lower/mod.rs:3979 — naga/src/front/wgsl/lower/mod.rs:3979-3986 | naga/src/front/wgsl/lower/mod.rs:5335-5340 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/wgsl/lower/mod.rs:3979` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (5–8 lines × 2) · ×1
  • Duplicated block (5–8 lines × 2) wgpu-core/src/device/resource.rs:4540 — wgpu-core/src/device/resource.rs:4540-4547 | wgpu-core/src/device/resource.rs:4696-4700 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/device/resource.rs:4540` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (7 lines × 6) · ×1
  • Duplicated block (7 lines × 6) naga/src/back/dot/mod.rs:378 — naga/src/back/dot/mod.rs:378-384 | naga/src/back/glsl/writer.rs:2288-2294 | naga/src/back/msl/writer.rs:4608-4614 | naga/src/back/wgsl/writer.rs:1209-1215 | naga/src/valid/analyzer.rs:1188-1194 | naga/src/valid/handles.rs:874-880 — `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 6 separate duplicated blocks between them, totalling at least 58 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/dot/mod.rs:378` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `naga/src/valid/handles.rs:873` calls `validate_expr` and `naga/src/back/dot/mod.rs:377` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (7 lines × 5) · ×1
  • Duplicated block (7 lines × 5) naga/src/front/wgsl/lower/mod.rs:5226 — naga/src/front/wgsl/lower/mod.rs:5226-5232 | naga/src/front/wgsl/lower/mod.rs:5243-5249 | naga/src/front/wgsl/lower/mod.rs:5259-5265 | naga/src/front/wgsl/lower/mod.rs:5274-5280 | naga/src/front/wgsl/lower/mod.rs:5290-5296 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/wgsl/lower/mod.rs:5226` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `naga/src/front/wgsl/lower/mod.rs:5239` calls `generate_ray_desc_type` and `naga/src/front/wgsl/lower/mod.rs:5285` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (11–14 lines × 2) · ×1
  • Duplicated block (11–14 lines × 2) naga/src/back/hlsl/help.rs:364 — naga/src/back/hlsl/help.rs:364-374 | naga/src/back/hlsl/help.rs:459-472 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/hlsl/help.rs:364` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `self` to `super) fn write_wrapped_image_load_function( &mut` in one and `super) fn write_wrapped_image_sample_function( &mut` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (6 lines × 7) · ×1
  • Duplicated block (6 lines × 7) naga/src/back/dot/mod.rs:379 — naga/src/back/dot/mod.rs:379-384 | naga/src/back/glsl/writer.rs:2289-2294 | naga/src/back/msl/writer.rs:4609-4614 | naga/src/back/wgsl/writer.rs:1210-1215 | naga/src/valid/analyzer.rs:1189-1194 | naga/src/valid/function.rs:755-760 | naga/src/valid/handles.rs:875-880 — `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 6 separate duplicated blocks between them, totalling at least 58 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `naga/src/valid/handles.rs:873` calls `validate_expr` and `naga/src/back/dot/mod.rs:377` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (6 lines × 6) · ×1
  • Duplicated block (6 lines × 6) naga/src/front/wgsl/lower/mod.rs:5225 — naga/src/front/wgsl/lower/mod.rs:5225-5230 | naga/src/front/wgsl/lower/mod.rs:5242-5247 | naga/src/front/wgsl/lower/mod.rs:5258-5263 | naga/src/front/wgsl/lower/mod.rs:5273-5278 | naga/src/front/wgsl/lower/mod.rs:5289-5294 | naga/src/front/wgsl/lower/mod.rs:5353-5358 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `naga/src/front/wgsl/lower/mod.rs:5239` calls `generate_ray_desc_type` and `naga/src/front/wgsl/lower/mod.rs:5285` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/front/glsl/builtins.rs:1079` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (5 lines × 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:1052-1056 | naga/src/front/spv/next_block.rs:1077-1081 | naga/src/front/spv/next_block.rs:1109-1113 | naga/src/front/spv/next_block.rs:1177-1181 | naga/src/front/spv/next_block.rs:1241-1245 | naga/src/front/spv/next_block.rs:1270-1274 | naga/src/front/spv/next_block.rs:1484-1489 | naga/src/front/spv/next_block.rs:1883-1888 | naga/src/front/spv/next_block.rs:2363-2371 | naga/src/front/spv/next_block.rs:2714-2719 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `naga/src/front/spv/next_block.rs:462` calls `next` and `naga/src/front/spv/next_block.rs:1050` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (5 lines × 5) · ×1
  • 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:1076-1080 | naga/src/front/spv/next_block.rs:1269-1273 | naga/src/front/spv/next_block.rs:1511-1516 | naga/src/front/spv/next_block.rs:2362-2370 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `naga/src/front/spv/next_block.rs:469` calls `lookup` and `naga/src/front/spv/next_block.rs:1082` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (3–5 lines × 4) · ×1
  • Duplicated block (3–5 lines × 4) naga/src/front/wgsl/lower/mod.rs:3684 — naga/src/front/wgsl/lower/mod.rs:3684-3688 | naga/src/front/wgsl/lower/mod.rs:3938-3940 | naga/src/front/wgsl/lower/mod.rs:3970-3974 | naga/src/front/wgsl/lower/mod.rs:5214-5218 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `naga/src/front/wgsl/lower/mod.rs:5212` calls `hit_object_pointer`, `next` and `naga/src/front/wgsl/lower/mod.rs:3936` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (6 lines × 9) · ×1
  • Duplicated block (6 lines × 9) 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:1695-1700 | wgpu-core/src/command/ray_tracing_pass.rs:266-271 | wgpu-core/src/command/render.rs:1006-1011 | wgpu-core/src/device/queue.rs:706-711 | wgpu-core/src/device/queue.rs:744-749 | wgpu-core/src/resource.rs:3047-3052 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wgpu-core/src/command/compute.rs:206` calls `TimestampWrites` and `wgpu-core/src/command/ray_tracing_pass.rs:262` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (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:4427-4438 | wgpu-core/src/command/render.rs:4484-4496 — before extracting anything, compare `wgpu-core/src/command/compute.rs` and `wgpu-core/src/command/render.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 76 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wgpu-core/src/command/compute.rs:1399` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (11 lines × 8) · ×1
  • Duplicated block (11 lines × 8) naga/src/back/msl/writer.rs:5364 — naga/src/back/msl/writer.rs:5364-5376 | naga/src/back/msl/writer.rs:5411-5423 | naga/src/back/msl/writer.rs:5582-5594 | naga/src/back/msl/writer.rs:5638-5648 | naga/src/back/msl/writer.rs:5693-5705 | naga/src/back/msl/writer.rs:5791-5803 | naga/src/back/msl/writer.rs:6007-6027 | naga/src/back/msl/writer.rs:6035-6050 — all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/msl/writer.rs:5364` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (11 lines × 3) · ×1
  • Duplicated block (11 lines × 3) naga/src/back/msl/writer.rs:5299 — naga/src/back/msl/writer.rs:5299-5309 | naga/src/back/msl/writer.rs:5503-5513 | naga/src/back/msl/writer.rs:5930-5940 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/msl/writer.rs:5299` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (10 lines × 6) · ×1
  • Duplicated block (10 lines × 6) naga/src/back/msl/writer.rs:5346 — naga/src/back/msl/writer.rs:5346-5356 | naga/src/back/msl/writer.rs:5393-5403 | naga/src/back/msl/writer.rs:5560-5570 | naga/src/back/msl/writer.rs:5617-5626 | naga/src/back/msl/writer.rs:5671-5681 | naga/src/back/msl/writer.rs:5734-5744 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `naga/src/back/msl/writer.rs:5346` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (5 lines × 4) · ×1
  • Duplicated block (5 lines × 4) naga/src/back/hlsl/help.rs:1032 — naga/src/back/hlsl/help.rs:1032-1036 | naga/src/back/hlsl/help.rs:1096-1100 | naga/src/back/hlsl/help.rs:1156-1160 | naga/src/back/hlsl/help.rs:1234-1238 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit. Note first that the copies are not typed on the same thing: the declarations holding them bind `self` to `super) fn write_wrapped_struct_matrix_get_function_name( &mut` in one and `super) fn write_wrapped_struct_matrix_set_function_name( &mut` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
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 — 47 finding(s)
D34 · Knowledge Freshness · Orphaned file · ×20
  • 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 wgpu-hal/src/auxil/renderdoc.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:1854 — `!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:4003 — `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:337 — `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:1693 — `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:1729 — `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:1488 — `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.
D30 · Dependency Vulnerabilities · Medium advisory (unmaintained) · ×2
  • REDACTED
  • REDACTED
D16 · Bus Factor · Off-boarding risk · ×1
  • Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 13 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, deno_webgpu/buffer.rs, wgpu-core-remote/src/global/command_encoder.rs, wgpu-core-remote-types/src/lib.rs, wgpu-core-remote/src/global/compute_pass.rs, wgpu-core-remote-types/src/binding_model.rs (+5 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 (18 single-owned of 382 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; 382 of the 469 production source files in this repository met that bar). They are anonymized user #2 (1 file(s)), anonymized user #3 (1 file(s)), anonymized user #4 (1 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/mesh_shader.rs, lock-analyzer/src/main.rs, naga/src/back/spv/layout.rs, wgpu-hal/src/vulkan/memory.rs, naga/hlsl-snapshots/src/lib.rs.
D20 · ADR Quality · No ADRs found · ×1
  • No ADRs found wgpu-info/src/main.rs:1 — 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/`. ADRs are expected here because `wgpu-info/src/main.rs` makes this repository a deployable product (line 1).
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` (114495 LoC, 406 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) — 20 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 12 more) (23 orphaned of 382 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; 382 of the 469 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:516 — `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 — 5 finding(s)
D12 · Dependency Hygiene · Outdated · ×5
  • 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: lock_api — `lock_api` is locked at 0.4.14 but 0.5.0 is the current stable release on crates.io, and it already satisfies the `">=0.4.6, <0.6.0"` requirement declared in wgpu-sync/Cargo.toml — so the lockfile is behind this repository's own declared range. This crosses a compatibility boundary. Run `cargo update -p lock_api` 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: parking_lot — `parking_lot` is locked at 0.12.5 but 0.13.0 is the current stable release on crates.io, and it already satisfies the `">=0.12.3, <0.14.0"` requirement declared in tests/Cargo.toml — so the lockfile is behind this repository's own declared range. This crosses a compatibility boundary. Run `cargo update -p parking_lot` and commit the updated REDACTED.
  • Outdated: ureq — `ureq` is locked at 3.5.1 but 3.5.2 is the current stable release on crates.io, and it already satisfies the `"3.2.0"` requirement declared in tests/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p ureq` 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/canine-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-ca02fb26c94745fa96e2f2b60973bd94/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/canine-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-ca02fb26c94745fa96e2f2b60973bd94/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/canine-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/** .9artifacts/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/** .0artifacts/raw/trivy-fs.json

Run 01a1d8cb-c806-7b0f-b4b8-735419855802 · 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