Public report — wgpu, published 27 Sep 2026. Concrete security findings (which rule fired, in which file, on which line; CVE IDs, secret matches, dependency versions) are REDACTED in this version; ask the repo owner for the full report.
Public
Codebase survey Measured under the Code Assurance Index · rubric rubric-2026.09.15 (frozen) · verify this survey Filed cd_f752d43e1ba140f29f89abe965fa4ea9 Filed 27 September 2026, 10:27 UTC Public

Gfx-Rs/wgpu

Measured 27 September 2026, 09:07 UTC

71% Strong
CriticalWeakAdequateStrongExemplary

Large · 262,468 LoC · rebuild ~3.3 person-years · weakest lens: Architecture (68%)

Findings by grade

34 critical 1576 serious 14 minor 43 could not be resolved — could be critical — see Limitations

This survey was produced by

Watchdog
Producer
Canine Development
Analyzer
Watchdog engine 1.0.0
Measured
27 September 2026, 09:07 UTC

A measurement, not a certificate. The Code Assurance Index does not certify, approve or guarantee this codebase; it records a reproducible number and the evidence it was computed from. The standard is authored by Canine Development, who also build Watchdog — its only implementation today. That is said here so the number is checked rather than believed.

Grounded in facts. Every number here is computed, not narrated — reproducible, tool-backed, and traceable to a line of code. How to trust this ▸

30/34dimensions tool-verifieddeterministic · confidence 1.0 · 4 LLM-assisted, advisory
1605findings with an exact file:lineof 1624 — the remainder are repo-wide signals (a dimension-level measurement, not a single line); open any file:line and verify
34/117dimensions across the health lenses262468 LoC — wide & deep
Chapters

Executive summary

The system holds a strong overall standing with a health score of 71%, indicating a robust asset that delivers value but carries specific, manageable risks. This score reflects a mature codebase where the foundation is solid, yet subtle architectural and security frictions threaten long-term efficiency. The organization has invested significantly in this large-scale environment, comprising over 260,000 lines of production code and 67,000 lines of tests. Rebuilding this logic from scratch would require approximately 3.3 person-years and nearly half a million euros, underscoring the high value tied up in the current architecture and the substantial cost of change.

The most critical risk is a hidden velocity tax on every modification. Code quality signals suggest that changes in weaker areas cost 6–13% more effort than in clean code. This inefficiency compounds annually, creating a significant drag on delivery speed. The top-ranked fix for this issue pays for itself in roughly one to two months by eliminating this recurring cost, making it the highest-leverage action for immediate improvement. Ignoring it results in a continuous, unbooked expense that erodes team capacity.

A second theme involves architectural coupling that threatens stability. Direct references between independent slices create brittle dependencies, meaning a change in one area can unexpectedly break another. Resolving these boundary-crossing issues by enforcing explicit contracts rather than direct links will reduce ripple effects and improve reliability. This structural clarity is essential for maintaining safe operations as the system evolves and new features are added.

Security exposure remains a concern, particularly around static analysis findings in CI/CD pipelines. While not all security lenses were measured, the identified vulnerabilities in automation scripts require immediate attention to prevent potential exposure. Conversely, the system’s strong production readiness and maturity scores indicate that the team has established good practices for testing and documentation, allowing new members to onboard effectively. Focus first on the velocity tax fix, as it offers the fastest return on investment and frees up resources to address deeper architectural and security concerns.

How the score is built — each lens's share of the headline Width is the lens's weight in the worst-heaviest fold (the weakest area pulls hardest); colour is that lens's own band. A lens fixes the score in proportion to its width.
Architecture 68% · 47% weightSecurity 69% · 26% weightMaturity 76% · 14% weightCode Health 77% · 8% weightReadiness 82% · 4% weight

Raise Architecture 68 → 70 (the Healthy floor) ⇒ headline 71 → ~71.

Code composition — where the lines go
Tests 100%
New since the last scan (100+)

1608 finding(s) are new versus the previous scan (2026-08-07) — surfaced by this scheduled scan itself, no pull request required. Showing the first 100; the full set is in the report.

  • D1 · Writer::write_expr (cyclomatic 300) naga/src/back/glsl/writer.rs
  • D1 · Frontend::next_block (cyclomatic 291) naga/src/front/spv/next_block.rs
  • D1 · BlockContext::cache_expression_value (cyclomatic 249) naga/src/back/spv/block.rs
  • D1 · Validator::validate_expression (cyclomatic 211) naga/src/valid/expression.rs
  • D1 · Writer::put_expression (cyclomatic 205) naga/src/back/msl/writer.rs
  • D1 · Writer::write_functions (cyclomatic 183) naga/src/back/msl/writer.rs
  • D1 · naga::front::glsl::builtins::inject_standard_builtins (cyclomatic 177) naga/src/front/glsl/builtins.rs
  • D1 · Queue::process (cyclomatic 177) wgpu-hal/src/gles/queue.rs
  • D1 · VaryingContext::validate_impl (cyclomatic 133) naga/src/valid/interface.rs
  • D1 · Validator::validate_block_impl (cyclomatic 133) naga/src/valid/function.rs
  • D1 · CapabilitiesQuery::new (cyclomatic 133) wgpu-hal/src/metal/adapter.rs
  • D1 · Writer::write_math_expression (cyclomatic 132) naga/src/back/hlsl/writer.rs
  • D1 · Writer::write_expr (cyclomatic 128) naga/src/back/hlsl/writer.rs
  • D1 · Error::as_parse_error (cyclomatic 123) naga/src/front/wgsl/error.rs
  • D1 · Writer::write_stmt (cyclomatic 122) naga/src/back/hlsl/writer.rs
  • D1 · Device::create_render_pipeline_or_error_inner (cyclomatic 122) wgpu-core/src/device/resource.rs
  • D1 · PrivateCapabilities::map_texture_format (cyclomatic 122) wgpu-hal/src/vulkan/conv.rs
  • D1 · PrivateTextureFormatCapabilities::map_format (cyclomatic 120) wgpu-hal/src/metal/adapter.rs
  • D1 · ConstantEvaluator::cast (cyclomatic 119) naga/src/proc/constant_evaluator.rs
  • D1 · ConstantEvaluator::binary_op (cyclomatic 119) naga/src/proc/constant_evaluator.rs
  • D1 · Writer::write_stmt (cyclomatic 103) naga/src/back/glsl/writer.rs
  • D1 · Adapter::expose (cyclomatic 103) wgpu-hal/src/dx12/adapter.rs
  • D1 · ResolveContext::resolve (cyclomatic 101) naga/src/proc/typifier.rs
  • D1 · Adapter::expose (cyclomatic 96) wgpu-hal/src/gles/adapter.rs
  • D1 · Writer::put_block (cyclomatic 95) naga/src/back/msl/writer.rs
  • D1 · ConstantEvaluator::math (cyclomatic 93) naga/src/proc/constant_evaluator.rs
  • D1 · naga::front::glsl::builtins::inject_common_builtin (cyclomatic 91) naga/src/front/glsl/builtins.rs
  • D1 · naga::front::wgsl::parse::conv::map_predeclared_type (cyclomatic 91) naga/src/front/wgsl/parse/conv.rs
  • D1 · Writer::write_stmt (cyclomatic 90) naga/src/back/wgsl/writer.rs
  • D1 · Lexer::next (cyclomatic 90) naga/src/front/glsl/lex.rs
  • D1 · Interface::check_stage (cyclomatic 85) wgpu-core/src/validation.rs
  • D1 · BlockContext::write_block (cyclomatic 83) naga/src/back/spv/block.rs
  • D1 · Validator::validate_type (cyclomatic 83) naga/src/valid/type.rs
  • D1 · TextureFormat::guaranteed_format_features (cyclomatic 82) wgpu-types/src/texture/format.rs
  • D1 · Writer::write_expr_plain_form (cyclomatic 80) naga/src/back/wgsl/writer.rs
  • D1 · Validator::validate_entry_point (cyclomatic 79) naga/src/valid/interface.rs
  • D1 · Lowerer::call_builtin (cyclomatic 74) naga/src/front/wgsl/lower/mod.rs
  • D1 · Writer::map_binding (cyclomatic 73) naga/src/back/spv/writer.rs
  • D1 · StatementGraph::add (cyclomatic 71) naga/src/back/dot/mod.rs
  • D1 · Context::lower_inner (cyclomatic 71) naga/src/front/glsl/context.rs
  • D1 · naga::front::glsl::builtins::inject_builtin (cyclomatic 70) naga/src/front/glsl/builtins.rs
  • D1 · FeaturesManager::check_availability (cyclomatic 69) naga/src/back/glsl/features.rs
  • D1 · Writer::collect_required_features (cyclomatic 62) naga/src/back/glsl/features.rs
  • D1 · naga::back::dot::write_function_expressions (cyclomatic 60) naga/src/back/dot/mod.rs
  • D1 · RenderPassInfo::start (cyclomatic 59) wgpu-core/src/command/render.rs
  • D1 · InstanceShared::inspect (cyclomatic 59) wgpu-hal/src/vulkan/adapter.rs
  • D1 · Adapter::texture_format_capabilities (cyclomatic 55) wgpu-hal/src/gles/adapter.rs
  • D1 · Writer::write_function (cyclomatic 54) naga/src/back/spv/writer.rs
  • D1 · Player::process (cyclomatic 54) player/src/lib.rs
  • D1 · Frontend::parse (cyclomatic 53) naga/src/front/spv/mod.rs
  • D1 · Parser::global_decl (cyclomatic 53) naga/src/front/wgsl/parse/mod.rs
  • D1 · Lowerer::statement (cyclomatic 51) naga/src/front/wgsl/lower/mod.rs
  • D1 · FunctionInfo::process_expression (cyclomatic 51) naga/src/valid/analyzer.rs
  • D1 · Validator::validate_global_var (cyclomatic 50) naga/src/valid/interface.rs
  • D1 · Adapter::texture_format_capabilities (cyclomatic 50) wgpu-hal/src/metal/adapter.rs
  • D1 · wgpu_core::command::ray_tracing::iter_blas (cyclomatic 49) wgpu-core/src/command/ray_tracing.rs
  • D1 · Texture::create_view_inner (cyclomatic 48) wgpu-core/src/resource.rs
  • D1 · PhysicalDeviceProperties::get_required_extensions (cyclomatic 48) wgpu-hal/src/vulkan/adapter.rs
  • D1 · Writer::write (cyclomatic 47) naga/src/back/glsl/writer.rs
  • D1 · naga::front::wgsl::parse::lexer::consume_token (cyclomatic 47) naga/src/front/wgsl/parse/lexer.rs
  • D1 · Adapter::device_from_raw (cyclomatic 47) wgpu-hal/src/vulkan/adapter.rs
  • D1 · Device::create_render_pipeline (cyclomatic 46) wgpu-hal/src/metal/device.rs
  • D1 · ParsingContext::parse_statement (cyclomatic 45) naga/src/front/glsl/parser/functions.rs
  • D1 · FunctionInfo::process_block (cyclomatic 45) naga/src/valid/analyzer.rs
  • D1 · wgpu_xtask::cts::run_cts (cyclomatic 45) xtask/src/cts.rs
  • D1 · naga::compact::compact (cyclomatic 44) naga/src/compact/mod.rs
  • D1 · naga::front::glsl::builtins::inject_double_builtin (cyclomatic 44) naga/src/front/glsl/builtins.rs
  • D1 · FeaturesManager::write (cyclomatic 42) naga/src/back/glsl/features.rs
  • D1 · Lowerer::expression_for_reference (cyclomatic 42) naga/src/front/wgsl/lower/mod.rs
  • D1 · ResolvedBinding::try_fmt (cyclomatic 41) naga/src/back/msl/mod.rs
  • D1 · MacroCall::call (cyclomatic 41) naga/src/front/glsl/builtins.rs
  • D1 · Frontend::parse_image_sample (cyclomatic 41) naga/src/front/spv/image.rs
  • D1 · Device::validate_texture_descriptor_inner (cyclomatic 41) wgpu-core/src/device/resource.rs
  • D1 · Writer::write_function (cyclomatic 40) naga/src/back/hlsl/writer.rs
  • D1 · Writer::write_logical_layout (cyclomatic 40) naga/src/back/spv/writer.rs
  • D1 · PhysicalDeviceFeatures::to_wgpu (cyclomatic 40) wgpu-hal/src/vulkan/adapter.rs
  • D1 · naga::front::glsl::types::parse_type (cyclomatic 39) naga/src/front/glsl/types.rs
  • D1 · naga::back::pipeline_constants::adjust_stmt (cyclomatic 39) naga/src/back/pipeline_constants.rs
  • D1 · PhysicalDeviceFeatures::from_extensions_and_requested_features (cyclomatic 39) wgpu-hal/src/vulkan/adapter.rs
  • D1 · Writer::write_enable_declarations (cyclomatic 38) naga/src/back/wgsl/writer.rs
  • D1 · Validator::validate_module_handles (cyclomatic 38) naga/src/valid/handles.rs
  • D1 · naga::common::wgsl::types::try_write_type_inner (cyclomatic 38) naga/src/common/wgsl/types.rs
  • D1 · Device::create_pipeline_layout (cyclomatic 38) wgpu-hal/src/dx12/device.rs
  • D1 · Frontend::function_call (cyclomatic 37) naga/src/front/glsl/functions.rs
  • D1 · naga::back::pipeline_constants::adjust_expr (cyclomatic 36) naga/src/back/pipeline_constants.rs
  • D1 · Resource::check_binding_use (cyclomatic 35) wgpu-core/src/validation.rs
  • D1 · TypeContext::fmt (cyclomatic 34) naga/src/back/msl/writer.rs
  • D1 · ExpressionTracer::trace_expression (cyclomatic 34) naga/src/compact/expressions.rs
  • D1 · Device::create_bind_group_layout_impl (cyclomatic 34) wgpu-core/src/device/resource.rs
  • D1 · CommandEncoder::begin_render_pass (cyclomatic 34) wgpu-hal/src/gles/command.rs
  • D1 · Writer::write_wrapper_function (cyclomatic 33) naga/src/back/msl/mesh_shader.rs
  • D1 · Writer::write (cyclomatic 33) naga/src/back/hlsl/writer.rs
  • D1 · FunctionTracer::trace_block (cyclomatic 33) naga/src/compact/statements.rs
  • D1 · FunctionMap::adjust_body (cyclomatic 33) naga/src/compact/statements.rs
  • D1 · Validator::validate_block_handles (cyclomatic 33) naga/src/valid/handles.rs
  • D1 · naga::back::glsl::conv::glsl_built_in (cyclomatic 33) naga/src/back/glsl/conv.rs
  • D1 · BlockContext::write_as_expression (cyclomatic 32) naga/src/back/spv/block.rs
  • D1 · Lowerer::construct (cyclomatic 31) naga/src/front/wgsl/lower/construction.rs
  • D1 · Parser::statement (cyclomatic 31) naga/src/front/wgsl/parse/mod.rs
  • D1 · naga_cli::bin::naga::run (cyclomatic 31) naga-cli/src/bin/naga.rs

A full-fidelity diff against the previous run's complete recorded findings — line-move tolerant: a finding that only shifted line counts as unchanged, only genuinely new titles/files surface here.

Rebuild cost & value ~ Modeled — €160,000–€810,000
Cost to rebuild€160,000–€810,000 (1.6–5.0 person-years (2,672–8,476 h), ~1–7 engineers)
Domain complexityStandard — harder problems cost more per line
Quality factor1.0× (at 71% quality) — the last 20% of quality is most of the work
Size & shapeLarge · effort split not classified (source measured from disk; the effort-tier breakdown is a C#-only syntax walk)

This codebase represents roughly ~3.3 person-years of build effort (about ~€480,000 to rebuild). Its weakest lens is Architecture at 68% — the part of that asset most exposed by the findings below.

How we model this: boilerplate at a scaffolding rate + logic × domain Standard (×1.1) — vertical slice × a 1.0× quality factor, at €60–95/h; indicative, ±~30% · size measured directly from source · effort from total production LoC as straight-line logic (the tier split is a C#-only syntax walk), a conservative lower bound. Indicative only — most sensitive to the hourly rate and the domain tier (both tunable in config).

Top priorities

The highest-leverage moves; the full ranked list is in the Roadmap below.

1
Resolve the 11 Boundary-crossing change coupling finding(s) in Change Coupling — start with adapter.rs (4), pipeline_cache.rs (3), conv.rs (2).
+2.4 pts · Medium effort · Change Coupling
2
Resolve the 1 Inconsistent error handling and access patterns for handle lookup.… finding(s) in Internal API Consistency.
+1.9 pts · Low effort · Internal API Consistency
3
Resolve the 1 Inconsistent naming for block modification operations. `push` adds a… finding(s) in Internal API Consistency.
+1.9 pts · Low effort · Internal API Consistency

Diagnosis — what's actually going on

The top fix pays for itself · High · Economics
The top-ranked fix costs roughly 3–10 engineer-days once. Not doing it costs about 52.5–315 engineer-days every year, paid as drag on the ~354,926 lines this team changes annually — a bill that arrives whether or not anyone books it. On those figures the fix breaks even in roughly 1–2 months and is free after that. Method, stated so this is not read as a quotation: debt from the ranked task's effort band; interest = annual changed lines (measured, annualised from the 90-day window) ÷ an ASSUMED 150–400 lines per engineer-day × the 6–13% drag implied by the code-quality signals; breaking point = debt ÷ annual interest. A modelled planning range built from measured inputs and one named assumption — not a quotation, a valuation, or a certified figure.
Evidence: D15 churn: 87,516 line(s) changed over a 90-day window ⇒ ~354,926/year · D1/D2/D4 code quality: averaging 5.6/10 ⇒ a 6–13% drag on each change · top-ranked remediation: Medium effort ⇒ about 3–10 engineer-day(s)
→ Do the top-ranked fix now if this code will still be yours in 2 months.
Highest-leverage move · Medium · Leverage
Of everything flagged, the best return on effort is: Keep slices independent: share cross-slice needs via an explicit contract/shared-kernel, not direct references between slices. The rest can wait behind it.
Evidence: priority ranking: top of 5 ranked by impact/effort
→ Keep slices independent: share cross-slice needs via an explicit contract/shared-kernel, not direct references between slices.
A velocity tax on every change · Medium · Economics
The code-quality signals (complexity, duplication, cohesion) average 5.6/10, which acts as a tax on every change in the weaker areas: modifications there plausibly cost on the order of 6–13% more than in clean code, and the tax compounds as the codebase grows. (A modelled estimate, not a measured fact.)
Evidence: D1/D2/D4 code quality: averaging 5.6/10 across the code-quality signals actually measured
→ Pay it down where churn is highest — the hotspots — not everywhere; that's where the tax is actually paid.

Architecture — module dependency matrix

Rows and columns are the same modules, ordered so that a module only depends on ones above it. A cell means the row depends on the column, and its number is how many type pairs create that dependency. Read one thing: is anything above the diagonal? A mark there is a dependency cycle. (A cycle is all this shows — an unusual but cycle-free dependency sits below the diagonal like any other.)

457 modules, 2278 dependencies. 1 dependency cycle across 204 modules, marked above the diagonal.

Showing the 40 most-connected modules; 417 more are not drawn.

Module dependency matrix. The row depends on the column; the number is how many type pairs create the dependency. A cell above the diagonal is part of a dependency cycle.
depends on →1 wgpu_types.features2 wgpu_types.limits3 naga.arena.range4 wgpu_types.error5 wgpu_types.texture.format6 naga.span7 wgpu_types.render8 naga.front.wgsl.lower9 wgpu_core.pipeline10 wgpu_types.texture11 wgpu_types.origin_extent12 wgpu_core.device.queue13 wgpu_core.command14 wgpu_core.command.render15 wgpu_core.resource16 wgpu.backend.webgpu17 wgpu.api.device18 wgpu_hal.dx1219 wgpu_hal.gles20 wgpu.api.render_pipeline21 wgpu.backend.wgpu_core22 wgpu.dispatch23 wgpu.api.buffer24 wgpu.api.bind_group25 wgpu_hal.vulkan26 player27 wgpu_hal28 naga.valid29 wgpu_core_remote.global30 wgpu_hal.noop31 naga_cli.bin.naga32 naga.front.wgsl.parse.ast33 wgpu_hal.metal34 naga.back.glsl35 naga.back.spv36 wgpu_core.device.resource37 naga.ir38 naga.arena.unique_arena39 naga.arena.handle40 naga.arena
1 wgpu_types.features
2 wgpu_types.limits
3 naga.arena.range11
4 wgpu_types.error2
5 wgpu_types.texture.format1311
6 naga.span113
7 wgpu_types.render32
8 naga.front.wgsl.lower4861643
9 wgpu_core.pipeline1018204381
10 wgpu_types.texture241321
11 wgpu_types.origin_extent111
12 wgpu_core.device.queue142212822
13 wgpu_core.command10131217411
14 wgpu_core.command.render361811217435413
15 wgpu_core.resource1244111811425
16 wgpu.backend.webgpu344141131862227221911
17 wgpu.api.device1111311321233
18 wgpu_hal.dx1222351415322232425213
19 wgpu_hal.gles32443414521103541921
20 wgpu.api.render_pipeline421
21 wgpu.backend.wgpu_core2331342103132372329
22 wgpu.dispatch23313373229229117
23 wgpu.api.buffer4322
24 wgpu.api.bind_group13
25 wgpu_hal.vulkan2242113812371
26 player13111112
27 wgpu_hal233653196236132611
28 naga.valid12268221
29 wgpu_core_remote.global12122151412125
30 wgpu_hal.noop1111121211113
31 naga_cli.bin.naga2212
32 naga.front.wgsl.parse.ast4137131
33 wgpu_hal.metal214211114411113
34 naga.back.glsl13212
35 naga.back.spv1225526151
36 wgpu_core.device.resource13121113111341
37 naga.ir21642142
38 naga.arena.unique_arena221
39 naga.arena.handle11
40 naga.arena121
Dependency, pointing down the layeringAbove the diagonal — part of a cycleThe module itself
wgpu_types.featureswgpu_types.limitsnaga.arena.rangewgpu_types.error…_types.texture.formatnaga.spanwgpu_types.rendernaga.front.wgsl.lowerwgpu_core.pipelinewgpu_types.texture…u_types.origin_extentwgpu_core.device.queuewgpu_core.command…u_core.command.renderwgpu_core.resourcewgpu.backend.webgpuwgpu.api.devicewgpu_hal.dx12wgpu_hal.gles…u.api.render_pipelinewgpu.backend.wgpu_corewgpu.dispatchwgpu.api.bufferwgpu.api.bind_groupwgpu_hal.vulkanplayerwgpu_halnaga.valid…pu_core_remote.globalwgpu_hal.noopnaga_cli.bin.naga….front.wgsl.parse.astwgpu_hal.metalnaga.back.glslnaga.back.spv…_core.device.resourcenaga.ir…ga.arena.unique_arenanaga.arena.handlenaga.arenawgpu_types.features1wgpu_types.limits2naga.arena.range3wgpu_types.error4…_types.texture.format5naga.span6wgpu_types.render7naga.front.wgsl.lower8wgpu_core.pipeline9wgpu_types.texture10…u_types.origin_extent11wgpu_core.device.queue12wgpu_core.command13…u_core.command.render14wgpu_core.resource15wgpu.backend.webgpu16wgpu.api.device17wgpu_hal.dx1218wgpu_hal.gles19…u.api.render_pipeline20wgpu.backend.wgpu_core21wgpu.dispatch22wgpu.api.buffer23wgpu.api.bind_group24wgpu_hal.vulkan25player26wgpu_hal27naga.valid28…pu_core_remote.global29wgpu_hal.noop30naga_cli.bin.naga31….front.wgsl.parse.ast32wgpu_hal.metal33naga.back.glsl34naga.back.spv35…_core.device.resource36naga.ir37…ga.arena.unique_arena38naga.arena.handle39naga.arena4011213111133248616431018204381241321111142212822101312174113618112174354131244111811425344141131862227221911111131132123322351415322232425213324434145211035419214212331342103132372329233133732292291174322132242113812371131111122336531962361326111226822112122151412125111112121111322124137131214211114411113132121225526151131211131113412164214222111121+417 more modules (most-connected shown)

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

At a glance — Architecture · 68% · Adequate · gated by AX7 ·

At a glance — Maturity · 76% · Strong ·

At a glance — Readiness · 82% · Strong ·

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

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
A03:2021 — Injection20High / Critical
A06:2021 — Vulnerable & Outdated Components9Medium

Roadmap

First, maintain slice independence by sharing cross-slice requirements through explicit contracts rather than direct references. Next, address static analysis findings in the CI configuration files to resolve mutable action tag issues. Then, reduce change coupling by fixing boundary-crossing issues in the adapter, pipeline cache, and convolution modules. Finally, standardize internal APIs by correcting inconsistent error handling, access patterns, and naming conventions for block modification operations.

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

Do thisHelpsEffortDimension
Resolve the 11 Boundary-crossing change coupling finding(s) in Change Coupling — start with adapter.rs (4), pipeline_cache.rs (3), conv.rs (2).+2.4 ptsMediumChange Coupling
Resolve the 1 Inconsistent error handling and access patterns for handle lookup.… finding(s) in Internal API Consistency.+1.9 ptsLowInternal API Consistency
Resolve the 1 Inconsistent naming for block modification operations. `push` adds a… finding(s) in Internal API Consistency.+1.9 ptsLowInternal API Consistency
Resolve the 1 Overlapping and confusingly named insertion/fetch operations.… finding(s) in Internal API Consistency.+1.9 ptsLowInternal API Consistency
Keep slices independent: share cross-slice needs via an explicit contract/shared-kernel, not direct references between slices.+3.4 ptsMediumSlice cohesion
Resolve the 1 No ADRs found finding(s) in ADR Quality.+1.3 ptsLowADR Quality
Resolve the 15 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (9), REDACTED (3), REDACTED (2).+2.4 ptsMediumStatic Analysis (SAST)
Resolve the 1 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED.+0.9 ptsLowStatic Analysis (SAST)

File quality

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

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

How the grades work

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

Critical — 34

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

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

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

Could not be resolved — 43

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

Methodology & how to trust this report

Watchdog is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. 30 of 34 evaluated dimensions are computed purely by tools and static analysis (confidence 1.0); 4 documentation/naming judgement(s) are LLM-assisted and labelled advisory. Overall confidence is 0.9 — the weighted average across measured dimensions; it falls as more of the score leans on LLM-assisted judgement and rises when it's fully tool-backed.

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

What we checked — 34 dimensions across the health lenses
D1D2D3D4D9D12D13D15D16D17D19D20D21D22D28D29D30D34D35D36D37D43AX10AX5AX7AX9M1M2M3M4P1P3P4P6

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, 1605 of 1624 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
  2. Is there a tool behind the number? Every score below names the method that produced it — Roslyn, git, a scanner, or (for a handful of documentation/naming dimensions) an LLM labelled sampled · advisory — not a narrative.
  3. Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.

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

Tools & methods

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

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

Every finding is locatable in findings.md. Run 01a0e21e-2c2d-798c-a195-02f39abe5e3d.

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

Run transparency — what happened this run

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

  • D8 Code Coverage — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT READ here — but this repository measures it: a Codecov configuration (codecov.yml) and a coverage step in CI (`lcov --output`) shows that coverage is collected and tracked in your own CI. The built-in collector has no runner for this ecosystem (.rs), so the analyzer could not read the number — a gap in the analyzer's language coverage, not an unmeasured repo. Not scored. To have the real number read, produce a coverage report in a standard format (lcov — `cargo install cargo-llvm-cov`, then `cargo llvm-cov --lcov --output-path lcov.info`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures. You can widen what we reach: optional: produce a coverage report in a standard format (lcov — `cargo install cargo-llvm-cov`, then `cargo llvm-cov --lcov --output-path lcov.info`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures — then the real number is read on the next scan.
  • D11 Test Reliability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test source is present (.rs) and this repository declares a Cargo test suite (repository root, 98 test files), but it was not re-run: no test result was produced. Not scored — this is a gap in the analyzer's language coverage, not a finding about this repository.
  • D44 Platform End-of-Life — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This dimension reads a project's own statement about the platform it runs on: a TargetFramework in a .NET project file, a .nvmrc or .python-version, a capped requires-python, or a framework major pinned by a dependency constraint. This repository carries none of them, so nothing about its platform was established. That is a gap in this analyzer's coverage, NOT a finding that the platform is supported — a language whose runtime is declared elsewhere (go.mod, a Gemfile's ruby directive, a Dockerfile) is simply not read here yet.
  • AX3 Project dependency cycles — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is computed over which project references which. That is a language-neutral question, but the project-reference graph is collected from MSBuild .csproj, Gradle and Maven builds only, and this repository commits none — so there was no graph to read, and re-running the same commit reads the same nothing. Its modules are declared as: npm/pnpm/yarn packages and workspaces (package.json, pnpm-workspace.yaml, lerna.json); Cargo crates and workspaces (Cargo.toml). A reader for that graph is the collector this check is missing. That is a COLLECTOR gap in this analyzer — no change to the scan image closes it — and not a finding that the repository is free of what this check looks for.
  • AX6 Interface segregation — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is computed over the public interfaces this run's compilations declare, and none was loaded, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • AX7 Slice cohesion — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 336 further occurrence(s) are not listed individually; the score already reflects all 376.
  • AX8 Test isolation — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is computed over which projects are test projects, and what they reference. That is a language-neutral question, but the project-reference graph is collected from MSBuild .csproj, Gradle and Maven builds only, and this repository commits none — so there was no graph to read, and re-running the same commit reads the same nothing. Its modules are declared as: npm/pnpm/yarn packages and workspaces (package.json, pnpm-workspace.yaml, lerna.json); Cargo crates and workspaces (Cargo.toml). A reader for that graph is the collector this check is missing. That is a COLLECTOR gap in this analyzer — no change to the scan image closes it — and not a finding that the repository is free of what this check looks for.
  • AXB1 Runtime evidence locked — no reproducible boot — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. The Runtime Evidence tier boots an app only via docker-compose, an Aspire AppHost, or a Dockerfile. None was found, so no live runtime a11y/egress/header evidence was collected. You can widen what we reach: add a docker-compose.yml (or an Aspire AppHost) that brings the app up with its dependencies. Watchdog then boots it in an isolated sandbox and gathers real runtime evidence — you change nothing in your pipeline (no CI step, no SDK).
  • C1 Data Protection — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These personal data controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks personal data controls.
  • C2 Access Controls — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These authorization controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks authorization controls.
  • C3 Audit Trail — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These audit controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks audit controls.
  • C4 Data Retention — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These retention controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks retention controls.
  • C5 Data-Subject Rights — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These data-subject rights controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks data-subject rights controls.
  • ED5 Idempotency — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check finds retry-prone mutations by walking the repository's declared types, and NONE was loaded on this run, so it had nothing to look at. That is a limit of the analyzer's reach — it reads .NET projects — not a finding that this repository has no command handlers or message consumers.
  • GD1 Unfinished & placeholder code — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
  • IC1 Incompleteness & stubs — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
  • P5 DR & Backup — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. No backup/snapshot/replication config, RTO/RPO or restore-procedure documentation was found — and no production persistence was detected either (no data-access packages, no data-store services, no database resources), so there is nothing in this repository whose loss a DR control would recover. If this system's data lives in a platform or ops repo we can't see, that's where the DR evidence belongs.
  • S1 Web-Security Posture — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These web-security controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks web-security controls.
  • X1 Async correctness — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
  • X12 Unreachable branch — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
  • X13 Undrained process stream — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
  • X14 Bypassable address classification — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
  • X15 Unvalidated length from an untrusted reader — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
  • X16 Unfloored truncation loop — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
  • X17 Uncapped recursion over a caller-supplied document — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
  • X18 Disposal-pattern correctness — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
  • X19 Unrestored process-global state — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
  • X2 Cancellation propagation — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
  • X20 Mistyped argument guard — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
  • X21 Side-effecting pattern guard — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
  • X22 Contradicted release guard — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
  • X23 Unguarded diagnostic materialisation — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
  • X24 Document value interpolated into markup unescaped — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
  • X25 Inert configuration knob — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
  • X26 Unsynchronised callback handoff — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
  • X27 Collection changed while being enumerated — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
  • X28 Index access outside its own emptiness guard — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
  • X29 Per-element action decided by a fixed element — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
  • X3 Exception handling — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
  • X30 Support guard that admits what it rejects — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
  • X32 Type resolved by simple name across every loaded assembly — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
  • X4 Structured logging — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
  • X5 Nullable reference types — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, 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.

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

Limitations & what we did not check

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

Per-dimension blind spots

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

  • D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
  • D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
  • D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
  • D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
  • D9 Test Distribution: The test-pyramid shape is inferred from project/folder naming and references, with a single test host bucketed per-file by its path tier and content signals — a suite that names tiers unconventionally and gives no per-file signal can still be mis-bucketed.
  • D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
  • D13 Secret Scanning: Secret detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
  • 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 is judged by an LLM over a bounded sample of docs — it reads what is written, not whether the docs match the running system, and it is advisory, not a measurement. Its critique rows are drawn from a closed category vocabulary and each row means the same thing in every run, so two scans can be compared row by row; the SET that fires is still a sample, and does not repeat exactly. Measured on one frozen input, six scans at one engine SHA: 2-5 critique rows per scan, 8 distinct rows across the six, 3 of those 8 seen in only one scan. So a D19 row is evidence about the documentation, but a COUNT of D19 rows is not a quantity — never read a change in it as an improvement or a regression.
  • D20 ADR Quality: ADR quality is an LLM read of the decision records present — it cannot know about decisions made and never recorded, and its verdict is sampled and advisory.
  • D21 Naming Consistency: Naming quality is an LLM judgement over a bounded sample — it assesses clarity/consistency of the names it sees, not domain-correctness, and is advisory.
  • D22 Internal API Consistency: API-surface coherence is an LLM judgement over a sample of the public surface — consistency of intent across the whole API is approximated, not exhaustively verified.
  • 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.
  • AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
  • AX9 CQS / query purity: Handlers are found by interface/name convention — a query handler using neither is not seen. Mutation is a resolved write/publish invocation (SaveChanges/repository/bus), so a write hidden behind a hand-rolled wrapper, reflection, or a string-keyed service locator resolves to a non-persistence type and isn't flagged; it detects that a query writes state, not whether the write is a legitimate read-side cache update. Clean means "no resolved write/publish in a query body", not a proof of CQS purity.
  • M4 Documentation accuracy: Onboarding quality is an LLM read of the docs/setup present — it cannot run the onboarding or measure how long a real new joiner takes; the verdict is sampled and advisory.
  • P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
  • P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.

The LLM boundary

LLM-set scores this run (4): D19, D21, D22, M4 (model: Local LLM). For these, a model reads a bounded sample and sets the numeric score; each names its own sample and method on its card. They are sampled and advisory by design: they vary at the margins between runs and are never a deterministic measurement. Every other score in this report is tool-computed at confidence 1.0.

Dimensions

D1 · Cyclomatic Complexity4.7 / 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.7 / 10 · rule-coverage 100% · ceiling Prevented

208 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was Writer::write_expr at 300. A further 69 method(s) were over the threshold but excluded as flat dispatchers (a long switch/match over independent cases: many branches, almost no nesting), the largest being AdapterShared::describe_texture_format at 104 — they are counted neither in the figure above nor in this dimension's score. 21 files carry no cyclomatic complexity row at all for this reason — every one of their over-threshold functions was excluded, so the exclusion is disclosed nowhere in the file itself: wgpu-hal/src/gles/conv.rs (AdapterShared::describe_texture_format at 104), deno_webgpu/texture.rs (TextureFormat::from at 95), wgpu-types/src/features.rs (Features::from_name at 82), 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) · ×47naga/src/back/glsl/writer.rs:2430
Device::create_render_pipeline_or_error_inner (cyclomatic 122) · ×19wgpu-core/src/device/resource.rs:4655
naga::front::glsl::builtins::inject_standard_builtins (cyclomatic 177) · ×18naga/src/front/glsl/builtins.rs:462
Frontend::next_block (cyclomatic 291) · ×13naga/src/front/spv/next_block.rs:22
Validator::validate_expression (cyclomatic 211) · ×10naga/src/valid/expression.rs:382

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

What to do

  1. Resolve the 47 Writer finding(s) in Cyclomatic Complexity — start with writer.rs (37), help.rs (4), mesh_shader.rs (2). — One of this dimension's main actionable groups (47 warning-level).
  2. Resolve the 19 Device finding(s) in Cyclomatic Complexity — start with device.rs (12), resource.rs (7). — One of this dimension's main actionable groups (19 warning-level).
  3. Resolve the 18 naga finding(s) in Cyclomatic Complexity — start with builtins.rs (4), pipeline_constants.rs (4), conv.rs (2). — One of this dimension's main actionable groups (18 warning-level).
  4. Enforce Cyclomatic Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D2 · Cognitive Complexity2.9 / 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.9 / 10 · rule-coverage 100% · ceiling Prevented

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

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

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

What to do

  1. Resolve the 60 Writer finding(s) in Cognitive Complexity — start with writer.rs (45), help.rs (8), mesh_shader.rs (3). — One of this dimension's main actionable groups (60 warning-level).
  2. Resolve the 26 Device finding(s) in Cognitive Complexity — start with device.rs (15), resource.rs (10), ray_tracing.rs. — One of this dimension's main actionable groups (26 warning-level).
  3. Resolve the 21 naga finding(s) in Cognitive Complexity — start with builtins.rs (5), pipeline_constants.rs (5), number.rs (3). — One of this dimension's main actionable groups (21 warning-level).
  4. Enforce Cognitive Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D3 · God Classes7.7 / 10Strong✓ Tool-verified

What it measures: Over-large classes that try to do too much ("god classes").

Method: God-class detection by line and method-count thresholds per logical type (partial classes unified), filtered for generated code and registration/contract false positives. Deterministic.

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

316 god class(es) detected.

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

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

What to do

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

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

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

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

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

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

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

Duplicated block (7 lines × 2) · ×27deno_webgpu/lib.rs:395
Duplicated block (11 lines × 2) · ×25naga/src/back/glsl/writer.rs:3184
Duplicated block (8 lines × 2) · ×25naga/src/back/dot/mod.rs:221
Duplicated block (6 lines × 2) · ×25naga/src/back/glsl/writer.rs:3537
Duplicated block (10 lines × 2) · ×23naga/src/back/glsl/writer.rs:1676

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

What to do

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

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

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

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

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d9_recommendation.md.

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

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

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

Maturity: Documented → Verified → Prevented · effective 9.1 / 10 · rule-coverage 93% · ceiling Verified

3 outdated, 0 yanked direct Cargo dependencies. 13 of 14 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: wasm-bindgen · ×3

✓ On the Gold path — maintain.

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

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

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

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

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

Secret scan ran and found no leaked secrets.

✓ On the Gold path — maintain.

Detailed fixes: d13_recommendation.md.

D15 · Churn × Complexity Hotspots8.7 / 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.7 / 10 · rule-coverage 100% · ceiling Documented

Top hotspots: wgpu-core/src/device/resource.rs (82×122=10004); wgpu/src/backend/webgpu.rs (29×97=2813); wgpu-hal/src/metal/adapter.rs (18×133=2394) Repeated repair below the complexity floor: wgpu-core/src/command/memory_init.rs (4 of 4 changes were fixes)

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

What to do

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

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

D16 · Bus Factor9.4 / 10Exemplary✓ Tool-verified

What it measures: Whether knowledge is concentrated in too few people (the "bus factor").

Method: Living knowledge per author via time-decayed commit attribution (6-month half-life, focus weighting) across largest source files. Deterministic, avoids blame's mechanical-refactor false positives.

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

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

Off-boarding risk: anonymized user #1 · ×2
Further sole-owners (lower concentration)

✓ 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 267 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

285 deducted task-comment markers across 262468 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 · ×243benches/benches/wgpu-benchmark/computepass.rs:79
HackComment · ×14naga/src/back/msl/writer.rs:3648
FixmeComment · ×7tests/tests/wgpu-validation/api/buffer_mapping.rs:1
XxxComment · ×2wgpu-hal/examples/raw-gles.rs:236
TodoComment repeated across 17 filesdeno_webgpu/texture.rs:89

What to do

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

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

D19 · Documentation QualityAdequate◐ Sampled · advisory

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

Method: Judged by language model at low temperature (0.0-0.1) on a deterministic doc sample (READMEs plus first 25 architecture docs), with two-pass stability filtering. Advisory, sampled.

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

The README files are strong examples of how to document a directory's purpose and usage (e.g. the big_compute_buffers example explains what it does, its prerequisites, and the To-Run shell commands), but they all fall below the repository-level documentation threshold: there is no single root README covering installation, build, or contribution guidance, and none of them documents architecture/design docs or a licence statement. (17 of 25 sampled documents could not be assessed: 1 of 2 evaluation groups failed.)

What to do

  1. Improve Documentation Quality — currently 6.0/10. — The README files are strong examples of how to document a directory's purpose and usage (e.g. the big_compute_buffers example explains what it does, its prerequisites, and the To-Run shell commands), but they all fall below the repository-level documentation threshold: there is no single root README covering installation, build, or contribution guidance, and none of them documents architecture/design docs or a licence statement. (17 of 25 sampled documents could not be assessed: 1 of 2 evaluation groups failed.)

Detailed fixes: d19_recommendation.md.

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

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

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

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

No architecture decision records were found.

No ADRs found

What to do

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

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

D21 · Naming ConsistencyExemplary◐ Sampled · advisory

What it measures: Whether names — types, methods, variables — are clear and consistent.

Method: Judged by language model at low temperature (0.0-0.1) on a deterministic random symbol sample (fixed size, not exhaustive), with disclosed confidence band. Advisory, sampled.

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

0 naming inconsistencies across 0 sampled symbols.

✓ On the Gold path — maintain.

Detailed fixes: d21_recommendation.md.

D22 · Internal API ConsistencyWeak◐ Sampled · advisory

What it measures: Whether the internal API surface is consistent and coherent.

Method: Judged by language model at low temperature over a sample of the public API surface (IsPackable or .Contracts types). Sampled, advisory; confidence discounted by model uncertainty.

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

5 API inconsistencies across a 400-member sample of 1025 exposed types.

Inconsistent error handling and access patterns for handle lookup. `try_get` returns a Result (implying Option-like behavior or error), `get_mut` panics or returns directly (unsafe/panic-on-missing), and `check_contains_handle` is a separate boolean/check operation. This forces users to choose between three different patterns for essentially the same intent: 'does this handle exist and can I access it?'.
Overlapping and confusingly named insertion/fetch operations. `fetch_if_or_append` and `fetch_or_append` are very similar, differing only by the presence of a predicate function. `append` is a simple insertion. The naming convention `fetch_*` suggests retrieval but these are primarily insertion/lookup hybrids. `fetch_if` is ambiguous: does it fetch if a condition is met, or fetch and then apply a condition?
Inconsistent naming for block modification operations. `push` adds a single item, `append` adds another block, `extend` adds items (but takes `u64` which is suspicious for a block of statements), and `extend_block` is redundant with `append`. `push` vs `append` vs `extend` is a common Rust pattern, but `append` taking a `Self` (another Block) is non-standard (usually `extend` takes an iterator or `push` takes a single item). `extend` taking `u64` is likely a bug or very specific internal use, breaking the iterator-like naming convention.
Inconsistent naming for version/target specification across backends. HLSL uses `shader_model`, MSL and GLSL use `lang_version` or `version`. This makes it hard to configure a generic pipeline or understand the target version without knowing the specific backend's property name.
Inconsistent naming for compatibility/fallback flags. `fake_missing_bindings` is specific to HLSL/MSL, while `spirv_cross_compatibility` is specific to MSL. These are both 'compatibility' or 'fallback' modes but named differently, making it hard to apply consistent configuration across backends.

What to do

  1. Resolve the 1 Inconsistent error handling and access patterns for handle lookup.… finding(s) in Internal API Consistency. — One of this dimension's main actionable groups (1 warning-level).
  2. Resolve the 1 Overlapping and confusingly named insertion/fetch operations.… finding(s) in Internal API Consistency. — One of this dimension's main actionable groups (1 warning-level).
  3. Resolve the 1 Inconsistent naming for block modification operations. `push` adds a… finding(s) in Internal API Consistency. — One of this dimension's main actionable groups (1 warning-level).

Detailed fixes: d22_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

20 finding(s): 0 critical, 20 high, 0 medium, 0 low. semgrep hit a parse error in 4 file(s) — `naga/src/front/wgsl/parse/number.rs` (line 104), `naga/src/proc/constant_evaluator.rs` (line 35), `wgpu-core/src/command/mod.rs` (line 1340, line 1414, line 1416, …), `wgpu-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 6 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 15 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (9), REDACTED (3), REDACTED (2). — One of this dimension's main actionable groups (15 issue-level).
  2. Resolve the 4 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (4). — One of this dimension's main actionable groups (4 issue-level).
  3. Resolve the 1 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).

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

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

What it measures: Whether any dependency has a known published vulnerability (CVE), direct or transitive, in ANY ecosystem the repository declares — Dart pub, Elixir/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, Go, Java and Kotlin via Maven/Gradle, npm, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift; `trivy fs --scanners vuln` for npm lockfiles; and `dotnet list package --vulnerable --include-transitive` for NuGet (with per-advisory collapse of the project x target-framework fan-out), plus a DECLARED-dependency arm that resolves a published gem's gemspec against rubygems.org where no Gemfile.lock is committed. `SeverityScore(c,h,m,l, normalizer 8.0)`. NotApplicable only when NO ecosystem is readable; if any applicable ecosystem could not be scanned the findings are REPORTED and the score is withheld. Supersedes the npm and OSV arms, retired 2026-09-05.

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

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

REDACTED

What to do

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

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

D34 · Knowledge Freshness9.6 / 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.6 / 10 · rule-coverage 100% · ceiling Documented

15 of 371 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 371 of the 456 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
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 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.6 / 10Adequategated by 11 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.6 / 10 · rule-coverage 100% · ceiling Documented

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

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

What to do

  1. Resolve the 11 Boundary-crossing change coupling finding(s) in Change Coupling — start with adapter.rs (4), pipeline_cache.rs (3), conv.rs (2). — One of this dimension's main actionable groups (11 issue-level).
  2. Resolve the 1 Change coupling clique finding(s) in Change Coupling — start with buffer.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 draw.rs. — One of this dimension's main actionable groups (1 warning-level).

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

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

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

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

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

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

REDACTED
REDACTED
REDACTED
REDACTED

What to do

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

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

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

What it measures: Whether the repository publishes a coordinated-vulnerability-disclosure policy (SECURITY.md or security.txt) with a reporting contact, so finders know how to report a vulnerability. Presence of a policy file with a contact, not whether the policy is adequate or honoured.

Method: Vulnerability-disclosure policy read deterministically from the repo: a SECURITY.md (root/.github/docs) or .well-known/security.txt / security.txt, regex-checked for a reporting contact (email / URL / mailto). Present + contact → 10; present without a contact → 4; NotApplicable when no policy file exists (it may live off-repo). Detects the policy file's presence + contact, not its adequacy.

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

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

✓ On the Gold path — maintain.

Detailed fixes: d37_recommendation.md.

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

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

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d43_recommendation.md.

Frontend & cross-cutting dimensions

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

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

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

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

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

What to do

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

Other · Architecture — Whether the codebase has a recognisable, scale-appropriate structure (a named architectural style, or modular enough for its size) rather than being an ad-hoc ball of mud.

Method: Roslyn plus csproj analysis: architecture style detection (DDD, clean, vertical-slice, CQRS) and structure fitness for repo size. Deterministic.

AX7 · Slice cohesion1.0 / 10Critical✓ Tool-verified

Other · Architecture — Whether feature slices stay independent (no direct cross-slice references) — the discipline that makes vertical-slice architecture pay off.

Method: Roslyn scan (vertical-slice gated): feature slices resolved from namespaces (.Features.*, .Slices.*) or project names; cross-slice type references detected. Deterministic, traceable.

  • `GPUAdapter` (slice 'deno_webgpu') depends on `Adapter` from slice 'wgpu'. — deno_webgpu/adapter.rs:68
  • `GPUSupportedLimits` (slice 'deno_webgpu') depends on `Limits` from slice 'wgpu_types'. — deno_webgpu/adapter.rs:348
  • `GPUSupportedFeatures` (slice 'deno_webgpu') depends on `Global` from slice 'wgpu_core_remote'. — deno_webgpu/adapter.rs:548
  • `GPUAdapterInfo` (slice 'deno_webgpu') depends on `AdapterInfo` from slice 'wgpu_types'. — deno_webgpu/adapter.rs:587
  • `GPUBindGroup` (slice 'deno_webgpu') depends on `BindGroup` from slice 'wgpu'. — deno_webgpu/bind_group.rs:26
  • `GPUBindGroupLayout` (slice 'deno_webgpu') depends on `BindGroupLayout` from slice 'wgpu'. — deno_webgpu/bind_group_layout.rs:14
  • `GPUBuffer` (slice 'deno_webgpu') depends on `Buffer` from slice 'wgpu'. — deno_webgpu/buffer.rs:63
  • `UnsafeWindowSurface` (slice 'deno_webgpu') depends on `Surface` from slice 'wgpu'. — deno_webgpu/byow.rs:94
  • `GPUCommandBuffer` (slice 'deno_webgpu') depends on `CommandBuffer` from slice 'wgpu'. — deno_webgpu/command_buffer.rs:12
  • `GPUCommandEncoder` (slice 'deno_webgpu') depends on `CommandEncoder` from slice 'wgpu'. — deno_webgpu/command_encoder.rs:29
  • `GPUComputePassEncoder` (slice 'deno_webgpu') depends on `ComputePass` from slice 'wgpu'. — deno_webgpu/compute_pass.rs:20
  • `GPUComputePipeline` (slice 'deno_webgpu') depends on `ComputePipeline` from slice 'wgpu'. — deno_webgpu/compute_pipeline.rs:18
  • `GPUDevice` (slice 'deno_webgpu') depends on `Device` from slice 'wgpu'. — deno_webgpu/device.rs:46
  • `DeviceErrorHandler` (slice 'deno_webgpu') depends on `Device` from slice 'wgpu'. — deno_webgpu/error.rs:42
  • `EventTargetSetup` (slice 'deno_webgpu') depends on `Global` from slice 'wgpu_core_remote'. — deno_webgpu/lib.rs:152
  • `ErrorEventClass` (slice 'deno_webgpu') depends on `Global` from slice 'wgpu_core_remote'. — deno_webgpu/lib.rs:156
  • `PipelineErrorClass` (slice 'deno_webgpu') depends on `Global` from slice 'wgpu_core_remote'. — deno_webgpu/lib.rs:157
  • `WGSLLanguageFeatures` (slice 'deno_webgpu') depends on `Global` from slice 'wgpu_core_remote'. — deno_webgpu/lib.rs:286
  • `GPUPipelineLayout` (slice 'deno_webgpu') depends on `PipelineLayout` from slice 'wgpu'. — deno_webgpu/pipeline_layout.rs:14
  • `GPUQuerySet` (slice 'deno_webgpu') depends on `QuerySet` from slice 'wgpu'. — deno_webgpu/query_set.rs:14
  • `GPUQueue` (slice 'deno_webgpu') depends on `Queue` from slice 'wgpu'. — deno_webgpu/queue.rs:26
  • `GPURenderBundleEncoder` (slice 'deno_webgpu') depends on `RenderBundleEncoder` from slice 'wgpu'. — deno_webgpu/render_bundle.rs:24
  • `GPURenderBundle` (slice 'deno_webgpu') depends on `RenderBundle` from slice 'wgpu'. — deno_webgpu/render_bundle.rs:369
  • `GPURenderPassEncoder` (slice 'deno_webgpu') depends on `RenderPass` from slice 'wgpu'. — deno_webgpu/render_pass.rs:30
  • `GPURenderPipeline` (slice 'deno_webgpu') depends on `RenderPipeline` from slice 'wgpu'. — deno_webgpu/render_pipeline.rs:22
  • `GPUSampler` (slice 'deno_webgpu') depends on `Sampler` from slice 'wgpu'. — deno_webgpu/sampler.rs:13
  • `GPUShaderModule` (slice 'deno_webgpu') depends on `ShaderModule` from slice 'wgpu'. — deno_webgpu/shader.rs:15
  • `GPUCompilationInfo` (slice 'deno_webgpu') depends on `Global` from slice 'wgpu_core_remote'. — deno_webgpu/shader.rs:155
  • `Configuration` (slice 'deno_webgpu') depends on `SurfaceConfiguration` from slice 'wgpu_hal'. — deno_webgpu/surface.rs:34
  • `GPUCanvasContext` (slice 'deno_webgpu') depends on `Surface` from slice 'wgpu'. — deno_webgpu/surface.rs:42
  • `GPUTexture` (slice 'deno_webgpu') depends on `Texture` from slice 'naga'. — deno_webgpu/texture.rs:45
  • `GPUTextureView` (slice 'deno_webgpu') depends on `TextureView` from slice 'wgpu'. — deno_webgpu/texture.rs:244
  • `GPUExternalTexture` (slice 'deno_webgpu') depends on `ExternalTexture` from slice 'wgpu'. — deno_webgpu/texture.rs:681
  • `GPUFeatureName` (slice 'deno_webgpu') depends on `Features` from slice 'wgpu_types'. — deno_webgpu/webidl.rs:397
  • `GPUTextureUsageFlags` (slice 'deno_webgpu') depends on `TextureUsages` from slice 'wgpu_types'. — deno_webgpu/webidl.rs:406
  • `GPUShaderStageFlags` (slice 'deno_webgpu') depends on `ShaderStages` from slice 'wgpu_types'. — deno_webgpu/webidl.rs:455
  • `GPUColorWriteFlags` (slice 'deno_webgpu') depends on `ColorWrites` from slice 'wgpu_types'. — deno_webgpu/webidl.rs:494
  • `OptionsProxy` (slice 'naga_fuzz') depends on `ShaderStage` from slice 'naga_cli'. — naga/fuzz/fuzz_targets/glsl_parser.rs:15
  • `FeaturesManager` (slice 'naga') depends on `Features` from slice 'wgpu_types'. — naga/src/back/glsl/features.rs:76
  • `PipelineOptions` (slice 'naga') depends on `ShaderStage` from slice 'naga_cli'. — naga/src/back/glsl/mod.rs:210

What to do

  • Keep slices independent: share cross-slice needs via an explicit contract/shared-kernel, not direct references between slices.
AX9 · CQS / query purity10.0 / 10Exemplary✓ Tool-verified

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

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

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

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

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

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

What to do

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

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

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

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

What to do

  • Record significant decisions one document per decision — dated, stating the context, the decision and its consequences — and keep them together wherever your design docs already live (a conventional `docs/adr/` tree, with each file named `NNNN-title` in whatever markup those docs already use, is the most discoverable form).
M3 · Folder & project structure10.0 / 10Exemplary✓ Tool-verified

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

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

M4 · Documentation accuracy9.0 / 10Exemplary◐ Sampled · advisory

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

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

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.

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.

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 Health77%Adequate — gated by D2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture68%Adequate — gated by AX7Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Maturity76%StrongSolid.
Readiness82%StrongStrongest area.
Security69%Adequate — gated by D29, D36Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Unscored — 2 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.
  • X9 Subsumed condition operand — 1 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 4 control(s) we could not find positive evidence for

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

  • C3 Audit Trail — Not assessed: these audit controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks audit controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C4 Data Retention — Not assessed: these retention controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks retention controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C5 Data-Subject Rights — Not assessed: these data-subject rights controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks data-subject rights controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 77 check(s) not relevant to this codebase

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

  • AC1 Text alternatives — No web markup found — accessibility is not applicable to this repository.
  • AC2 Forms & labels — No web markup found — accessibility is not applicable to this repository.
  • AC3 Page structure — No web markup found — accessibility is not applicable to this repository.
  • AC4 Keyboard semantics — No web markup found — accessibility is not applicable to this repository.
  • AC5 ARIA correctness — No web markup found — accessibility is not applicable to this repository.
  • AC6 Visual & motion safety — No web markup found — accessibility is not applicable to this repository.
  • AC7 A11y enforcement — No web markup found — accessibility is not applicable to this repository.
  • AX1 Captive dependencies — no DI registrations detected
  • AX2 Stateful singletons — no singleton implementations detected
  • AX3 Project dependency cycles — not assessed — project cycles and dependency direction are computed over a project-reference graph that was not loaded for this repository, because the repository commits no project file of a kind this check models. This is a gap in the analyzer, not a finding about this repository
  • AX4 Dependency direction — not applicable to a vertical-slice architecture (the inward-dependency rule is for layered/clean styles)
  • 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
  • AX8 Test isolation — not assessed — test isolation is computed from a project graph (which projects are test projects, and what they reference) that was not loaded for this repository, because the repository commits no project file of a kind this check models. This is a gap in the analyzer, not a finding about this repository
  • 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 — Not assessed: these personal data controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks personal data controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C2 Access Controls — Not assessed: these authorization controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks authorization controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • D10 Test Quality — ~67010 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
  • D14 License Compliance — Not scored — this repository's 537 shipped crate(s) were read from its REDACTED, but crates.io could not be asked for the licence of 39 of them (HTTP 429 Unknown Error), and a licence verdict over part of a dependency graph is not a licence verdict. Nothing is asserted about this repository's licensing in either direction.
  • 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.
  • D23 Boundary Type-Coupling — Production source is present (.rs) but bounded contexts are resolved over the C#/VB project set, which exposed none, so context scope could not be assessed. Not scored — this is a gap in the analyzer, not a verdict about this repository. Declaring the codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed — see the recommendation on this dimension for where. 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 — No inline comments to assess — comment value is not applicable here.
  • D25 ADR Conformance — no ADRs to check
  • D26 Project Cohesion — Project cohesion is assessed over the .NET project set; this target exposed no projects, so project size and spread could not be assessed. Not scored — this is a gap in the analyzer's reach, not a verdict about this repository.
  • D27 Navigability — symbol resolution incomplete — too few calls resolved to assess navigability
  • D31 IaC & Container Security — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
  • D32 Data Compliance (PII/GDPR) — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that.
  • D39 IL Efficiency — D39 measures the IL emitted by a .NET build; this repository has no .NET solution or project files, so the dimension does not apply.
  • D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
  • D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
  • D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
  • D44 Platform End-of-Life — Platform end-of-life not assessed — this repository declares no platform this pass reads
  • D5 Coupling — Inter-project coupling could not be assessed — no analyzable project graph was found for this repository. Not scored: a gap in the analyzer's reach, not a verdict about this repository. (Coupling here is Martin afferent/efferent/instability plus reference cycles across a project-reference graph, read today from .NET project files; other ecosystems' module graphs are not read yet.)
  • D6 Cohesion (LCOM4) — Cohesion (LCOM4) is measured over a CS/VB/GO/SCALA/SWIFT/DART class graph, and this repository's production source is .rs, which this pass does not read — so no class could be assessed. Not scored — this is a gap in the analyzer, not a finding about this repository.
  • D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
  • D8 Code Coverage — Coverage not included — suite not readable by the collector
  • DM1 Domain Modelling — applicable but not scored (2 of 3 signals for this style — below the bar we score at): 279 aggregate root(s) (types guarding their own state behind command methods — this language has no AggregateRoot base to inherit); 176 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 — This check finds retry-prone mutations (command handlers and message/event consumers) by walking the repository's declared types, and none was loaded here, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • 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# syntax, and none was loaded for this repository. 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
  • P2 Observability — Observability was not assessed: this check reads a source model that does not carry this repository's product — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of a logging idiom this check recognises is NOT evidence that this repo lacks structured logging (it may log through its own ecosystem's logger). This is a gap in the analyzer, not a finding about this repository.
  • P7 Outbound HTTP resilience — not measured — the application kind could not be determined for this repo
  • P8 Schema migrations — not assessed — schema-migration practice is read from 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
  • P9 Domain vs controller coverage — no coverage report found on disk — produce a coverage report in a standard format (lcov — `cargo install cargo-llvm-cov`, then `cargo llvm-cov --lcov --output-path lcov.info`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures, or wire coverage collection into CI, to enable this cross-layer check
  • PF1 Benchmark discipline — Performance was not assessed: this lens reads a source model that was not loaded for this repository, because the repository is written in a language this lens does not yet model or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository — in particular it is NOT a statement that this repo is unpackaged or performance-careless.
  • PF2 Allocation hygiene — Performance was not assessed: this lens reads a source model that was not loaded for this repository, because the repository is written in a language this lens does not yet model or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository — in particular it is NOT a statement that this repo is unpackaged or performance-careless.
  • PF3 Async & latency hygiene — Performance was not assessed: this lens reads a source model that was not loaded for this repository, because the repository is written in a language this lens does not yet model or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository — in particular it is NOT a statement that this repo is unpackaged or performance-careless.
  • S1 Web-Security Posture — Not assessed: these web-security controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks web-security controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • X1 Async correctness — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X12 Unreachable branch — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X13 Undrained process stream — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X14 Bypassable address classification — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X15 Unvalidated length from an untrusted reader — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X16 Unfloored truncation loop — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X17 Uncapped recursion over a caller-supplied document — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X18 Disposal-pattern correctness — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X19 Unrestored process-global state — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X2 Cancellation propagation — 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
  • X20 Mistyped argument guard — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X21 Side-effecting pattern guard — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X22 Contradicted release guard — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X23 Unguarded diagnostic materialisation — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X24 Document value interpolated into markup unescaped — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X25 Inert configuration knob — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X26 Unsynchronised callback handoff — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X27 Collection changed while being enumerated — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X28 Index access outside its own emptiness guard — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X29 Per-element action decided by a fixed element — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X3 Exception handling — 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
  • X30 Support guard that admits what it rejects — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X32 Type resolved by simple name across every loaded assembly — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X4 Structured logging — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X5 Nullable reference types — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository

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 — 34 finding(s)
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D35 · Change Coupling · Boundary-crossing change coupling · ×11
  • Boundary-crossing change coupling: adapter.rs ↔ human.rs wgpu-hal/src/dx12/adapter.rs — `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 — `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 — `wgpu-core/src/conv.rs` (context wgpu-core) and `wgpu-types/src/lib.rs` (context wgpu-types) sit in DIFFERENT parts of the tree yet change together 67% of the time (43 of the 64 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 43 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 — `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 — `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 — `wgpu-hal/src/metal/adapter.rs` (context wgpu-hal) and `wgpu-info/src/human.rs` (context wgpu-info) sit in DIFFERENT parts of the tree yet change together 55% of the time (12 of the 22 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 12 shared commits counted here, the most recent 3 are `9920c99c` feat(core): add `Limits::max_storage_{buffers,textures}_in_{vertex,fr…; `995ee7b3` add `Limits::max_buffers_and_acceleration_structures_per_shader_stage`; `4bbed407` add `max_bind_groups_plus_vertex_buffers` limit — run `git show` on any of them.
  • Boundary-crossing change coupling: webidl.rs ↔ adapter.rs deno_webgpu/webidl.rs — `deno_webgpu/webidl.rs` (context deno_webgpu) and `wgpu-hal/src/metal/adapter.rs` (context wgpu-hal) sit in DIFFERENT parts of the tree yet change together 53% of the time (8 of the 15 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `ca3239e6` chore!: Move `PRIMITIVE_INDEX` feature into the WebGPU group (#9101); `3dfa9af0` Enable `FLOAT32_BLENDABLE` on Metal, in Deno, and separate from filte…; `8f50bb9d` Make passthrough shaders non-experimental (#9054) — run `git show` on any of them.
  • Boundary-crossing change coupling: conv.rs ↔ lib.rs wgpu-hal/src/auxil/dxgi/conv.rs — `wgpu-hal/src/auxil/dxgi/conv.rs` (context wgpu-hal) and `wgpu-types/src/lib.rs` (context wgpu-types) sit in DIFFERENT parts of the tree yet change together 50% of the time (11 of the 22 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 11 shared commits counted here, the most recent 3 are `0b6571a6` Align Storage Access enums to spec (#6642); `07684d36` Rename Rg11b10UFloat to Rg11b10Ufloat (#6226); `c6a3d927` `Rg11b10Float` -> `Rg11b10UFloat` and deduplicate entries in `TEXTURE… — run `git show` on any of them.
  • Boundary-crossing change coupling: pipeline_cache.rs ↔ lib.rs wgpu-core/src/pipeline_cache.rs — `wgpu-core/src/pipeline_cache.rs` (context wgpu-core) and `wgpu-types/src/lib.rs` (context wgpu-types) sit in DIFFERENT parts of the tree yet change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `55b45559` feat(core): Limit bucketing; `9a41de4e` Move subgroup size info to AdapterInfo (#8609); `0810110b` Add pci bus and device uuid to `AdapterInfo` (#8290) — run `git show` on any of them.
  • Boundary-crossing change coupling: pipeline_cache.rs ↔ mod.rs wgpu-core/src/pipeline_cache.rs — `wgpu-core/src/pipeline_cache.rs` (context wgpu-core) and `wgpu-hal/src/metal/mod.rs` (context wgpu-hal) sit in DIFFERENT parts of the tree yet change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `c841633b` Bring transient attachment in line with webgpu spec (#9568); `55b45559` feat(core): Limit bucketing; `9a41de4e` Move subgroup size info to AdapterInfo (#8609) — run `git show` on any of them.
  • Boundary-crossing change coupling: pipeline_cache.rs ↔ webgpu.rs wgpu-core/src/pipeline_cache.rs — `wgpu-core/src/pipeline_cache.rs` (context wgpu-core) and `wgpu/src/backend/webgpu.rs` (context wgpu) sit in DIFFERENT parts of the tree yet change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `c841633b` Bring transient attachment in line with webgpu spec (#9568); `55b45559` feat(core): Limit bucketing; `9a41de4e` Move subgroup size info to AdapterInfo (#8609) — 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 — 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 — 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 — 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 — 1576 finding(s)
D17 · Explicit Debt · TodoComment · ×243
  • TodoComment benches/benches/wgpu-benchmark/computepass.rs:79 — // TODO: as of writing llvmpipe segfaults the bindless benchmark on ci — 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 benches/benches/wgpu-benchmark/computepass.rs:81 — // TODO(https://github.com/gfx-rs/wgpu/issues/9849): Currently broken on Metal
  • TodoComment deno_webgpu/texture.rs:257 — // TODO(@crowlKats): weakref in texture for view — 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 deno_webgpu/error.rs:82 — // TODO(@crowlKats): consider adding an unreachable value that uses unreachable!() — 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 deno_webgpu/compute_pipeline.rs:56 — // TODO(wgpu): needs to support retrieving the label — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment deno_webgpu/byow.rs:93 — // TODO(@littledivy): This will extend `OffscreenCanvas` when we add it. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment deno_webgpu/adapter.rs:614 — // TODO(https://github.com/gfx-rs/wgpu/issues/8649): implement when wgpu has architecture detection
  • TodoComment examples/features/src/msaa_line/mod.rs:230 — // TODO: Switch back to full scans of possible options when we expose — 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 examples/features/src/texture_arrays/mod.rs:123 — // TODO: Because naga's capabilities are evaluated on validate, not on write, we cannot make a shader module with unsupported — 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/fuzz/fuzz_targets/ir.rs:10 — //TODO: may also fuzz the flags and capabilities — 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/lib.rs:134 — // TODO: Eliminate this re-export and migrate uses of `crate::Foo` to `use crate::ir; ir::Foo`. — 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/mod.rs:307 — // TODO: We need a better fix for named `Load` expressions — 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/dot/mod.rs:94 — //TODO: link to the beginning — 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:149 — // TODO: Should this be user 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 naga/src/back/glsl/writer.rs:2429 — // TODO(https://github.com/gfx-rs/wgpu/issues/9456)
  • TodoComment naga/src/front/glsl/context.rs:543 — // TODO(https://github.com/gfx-rs/wgpu/issues/9456)
  • TodoComment naga/src/front/spv/next_block.rs:21 — // TODO(https://github.com/gfx-rs/wgpu/issues/9456)
  • TodoComment naga/src/valid/function.rs:788 — // TODO(https://github.com/gfx-rs/wgpu/issues/9456)
  • TodoComment naga/src/back/glsl/writer.rs:2560 — //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 wgpu-hal/src/vulkan/adapter.rs:2566 — //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:2626 — // TODO: handle clamp_to_edge — 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:2982 — // `BinaryOperation::ModuloInt` below. Remaining TODO: the degenerate — 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:3044 — // TODO: Boolean mix on desktop required GL_EXT_shader_integer_mix — 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.
  • + 218 more in this group — see findings.md.
D3 · God Classes · MethodTooLong · ×153
  • MethodTooLong: Frontend.next_block naga/src/front/spv/next_block.rs:22 — MethodTooLong — next_block runs 2229 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 2129 over it, 22.29× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Queue.process wgpu-hal/src/gles/queue.rs:192 — MethodTooLong — process runs 1310 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 1210 over it, 13.10× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Error.as_parse_error naga/src/front/wgsl/error.rs:678 — MethodTooLong — as_parse_error runs 813 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 713 over it, 8.13× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Validator.validate_expression naga/src/valid/expression.rs:382 — MethodTooLong — validate_expression runs 741 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 641 over it, 7.41× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Validator.validate_block_impl naga/src/valid/function.rs:789 — MethodTooLong — validate_block_impl runs 734 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 634 over it, 7.34× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Writer.write_expr naga/src/back/hlsl/writer.rs:3729 — MethodTooLong — write_expr runs 668 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 568 over it, 6.68× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Lowerer.call_builtin naga/src/front/wgsl/lower/mod.rs:3094 — MethodTooLong — call_builtin runs 651 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 551 over it, 6.51× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Adapter.expose wgpu-hal/src/dx12/adapter.rs:65 — MethodTooLong — expose runs 649 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 549 over it, 6.49× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Writer.write_stmt naga/src/back/hlsl/writer.rs:2198 — MethodTooLong — write_stmt runs 645 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 545 over it, 6.45× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Device.create_render_pipeline_or_error_inner wgpu-core/src/device/resource.rs:4655 — MethodTooLong — create_render_pipeline_or_error_inner runs 612 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 512 over it, 6.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: Adapter.expose wgpu-hal/src/gles/adapter.rs:195 — MethodTooLong — expose runs 568 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 468 over it, 5.68× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Context.lower_inner naga/src/front/glsl/context.rs:544 — MethodTooLong — lower_inner runs 544 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 444 over it, 5.44× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: VaryingContext.validate_impl naga/src/valid/interface.rs:234 — MethodTooLong — validate_impl runs 446 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 346 over it, 4.46× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Writer.write_math_expression naga/src/back/hlsl/writer.rs:3078 — MethodTooLong — write_math_expression runs 429 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 329 over it, 4.29× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ResolveContext.resolve naga/src/proc/typifier.rs:265 — MethodTooLong — resolve runs 419 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 319 over it, 4.19× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ConstantEvaluator.math naga/src/proc/constant_evaluator.rs:1489 — MethodTooLong — math runs 418 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 318 over it, 4.18× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Device.create_pipeline_layout wgpu-hal/src/dx12/device.rs:970 — MethodTooLong — create_pipeline_layout runs 397 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 297 over it, 3.97× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Validator.validate_type naga/src/valid/type.rs:383 — MethodTooLong — validate_type runs 396 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 296 over it, 3.96× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Writer.write_expr_plain_form naga/src/back/wgsl/writer.rs:1502 — MethodTooLong — write_expr_plain_form runs 391 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 291 over it, 3.91× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: RenderPassInfo.start wgpu-core/src/command/render.rs:1218 — MethodTooLong — start runs 382 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 282 over it, 3.82× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Lowerer.statement naga/src/front/wgsl/lower/mod.rs:1794 — MethodTooLong — statement runs 381 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 281 over it, 3.81× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Writer.write_ray_query_get_intersection_function naga/src/back/spv/ray/query.rs:15 — MethodTooLong — write_ray_query_get_intersection_function runs 379 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 279 over it, 3.79× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Writer.write_function naga/src/back/spv/writer.rs:1260 — MethodTooLong — write_function runs 373 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 273 over it, 3.73× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: CapabilitiesQuery.new wgpu-hal/src/metal/adapter.rs:675 — MethodTooLong — new runs 369 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 269 over it, 3.69× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Writer.write_stmt naga/src/back/wgsl/writer.rs:746 — MethodTooLong — write_stmt runs 366 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 266 over it, 3.66× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • + 128 more in this group — see findings.md.
D3 · God Classes · FileTooLong · ×85
  • FileTooLong: msl/writer.rs naga/src/back/msl/writer.rs — FileTooLong — 6079 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 5579 over it, 12.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: device/resource.rs wgpu-core/src/device/resource.rs — FileTooLong — 3749 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 97% of them inside a single declaration: Device (6 blocks, 232-5884). The bar is 500 significant lines; this is 3249 over it, 7.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: hlsl/writer.rs naga/src/back/hlsl/writer.rs — FileTooLong — 3528 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 94% of them inside a single declaration: Writer (154-4943). The bar is 500 significant lines; this is 3028 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: lower/mod.rs naga/src/front/wgsl/lower/mod.rs — FileTooLong — 3283 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 78% of them inside a single declaration: Lowerer (2 blocks, 1264-5076). The bar is 500 significant lines; this is 2783 over it, 6.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: command/render.rs wgpu-core/src/command/render.rs — FileTooLong — 3104 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 2604 over it, 6.21× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: backend/webgpu.rs wgpu/src/backend/webgpu.rs — FileTooLong — 3042 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 54 free functions. The bar is 500 significant lines; this is 2542 over it, 6.08× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: spv/block.rs naga/src/back/spv/block.rs — FileTooLong — 2872 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 2372 over it, 5.74× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: proc/constant_evaluator.rs naga/src/proc/constant_evaluator.rs — FileTooLong — 2843 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 70% of them inside a single declaration: ConstantEvaluator (2 blocks, 683-3816). The bar is 500 significant lines; this is 2343 over it, 5.69× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: glsl/writer.rs naga/src/back/glsl/writer.rs — FileTooLong — 2819 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 2319 over it, 5.64× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: spv/writer.rs naga/src/back/spv/writer.rs — FileTooLong — 2694 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-4027). The bar is 500 significant lines; this is 2194 over it, 5.39× 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 — 2355 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 1855 over it, 4.71× 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 — 2318 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 1818 over it, 4.64× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: spv/next_block.rs naga/src/front/spv/next_block.rs — FileTooLong — 2257 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 99% of them inside a single declaration: Frontend (15-3107). The bar is 500 significant lines; this is 1757 over it, 4.51× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: vulkan/device.rs wgpu-hal/src/vulkan/device.rs — FileTooLong — 2203 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-3092). The bar is 500 significant lines; this is 1703 over it, 4.41× 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 — 2136 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-3221). The bar is 500 significant lines; this is 1636 over it, 4.27× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: backend/wgpu_core.rs wgpu/src/backend/wgpu_core.rs — FileTooLong — 1991 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 1491 over it, 3.98× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: dx12/device.rs wgpu-hal/src/dx12/device.rs — FileTooLong — 1911 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 99% of them inside a single declaration: Device (2 blocks, 40-2787). The bar is 500 significant lines; this is 1411 over it, 3.82× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: parse/mod.rs naga/src/front/wgsl/parse/mod.rs — FileTooLong — 1621 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1121 over it, 3.24× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: metal/device.rs wgpu-hal/src/metal/device.rs — FileTooLong — 1600 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 92% of them inside a single declaration: Device (2 blocks, 162-2266). The bar is 500 significant lines; this is 1100 over it, 3.20× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: glsl/builtins.rs naga/src/front/glsl/builtins.rs — FileTooLong — 1581 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1081 over it, 3.16× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: hlsl/help.rs naga/src/back/hlsl/help.rs — FileTooLong — 1534 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1034 over it, 3.07× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/validation.rs wgpu-core/src/validation.rs — FileTooLong — 1514 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 1014 over it, 3.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: gles/queue.rs wgpu-hal/src/gles/queue.rs — FileTooLong — 1498 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 98% of them inside a single declaration: Queue (2 blocks, 53-2008). The bar is 500 significant lines; this is 998 over it, 3.00× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: wgsl/writer.rs naga/src/back/wgsl/writer.rs — FileTooLong — 1459 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 93% of them inside a single declaration: Writer (2 blocks, 82-2141). The bar is 500 significant lines; this is 959 over it, 2.92× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: valid/function.rs naga/src/valid/function.rs — FileTooLong — 1446 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 80% of them inside a single declaration: Validator (348-1998). The bar is 500 significant lines; this is 946 over it, 2.89× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • + 60 more in this group — see findings.md.
D15 · Churn × Complexity Hotspots · Hotspot · ×65
  • Hotspot: wgpu-core/src/device/resource.rs wgpu-core/src/device/resource.rs:4655 — wgpu-core/src/device/resource.rs changed 82 times in last 90 days, max cyclomatic complexity 122 in Device::create_render_pipeline_or_error_inner at line 4655. 17 of those changes were fix/bug commits, and the other 65 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-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 06:46:29 +00:00' --until='2026-09-27 06:46:29 +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/src/backend/webgpu.rs wgpu/src/backend/webgpu.rs:223 — wgpu/src/backend/webgpu.rs changed 29 times in last 90 days, max cyclomatic complexity 97 in wgpu::backend::webgpu::map_texture_format at line 223. 4 of those changes were fix/bug commits, and the other 25 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 06:46:29 +00:00' --until='2026-09-27 06:46:29 +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: wgpu-hal/src/metal/adapter.rs wgpu-hal/src/metal/adapter.rs:675 — wgpu-hal/src/metal/adapter.rs changed 18 times in last 90 days, max cyclomatic complexity 133 in CapabilitiesQuery::new at line 675. 4 of those changes were fix/bug commits, and the other 14 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-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 06:46:29 +00:00' --until='2026-09-27 06:46:29 +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: player/src/lib.rs player/src/lib.rs:100 — player/src/lib.rs changed 44 times in last 90 days, max cyclomatic complexity 54 in Player::process at line 100. 1 of those changes was a fix/bug commit, and the other 43 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-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 06:46:29 +00:00' --until='2026-09-27 06:46:29 +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/command/render.rs wgpu-core/src/command/render.rs:1218 — wgpu-core/src/command/render.rs changed 32 times in last 90 days, max cyclomatic complexity 59 in RenderPassInfo::start at line 1218. 8 of those changes were fix/bug commits, and the other 24 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 06:46:29 +00:00' --until='2026-09-27 06:46:29 +00:00' --full-history --no-merges -- wgpu-core/src/command/render.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: wgpu-core/src/resource.rs wgpu-core/src/resource.rs:1856 — wgpu-core/src/resource.rs changed 36 times in last 90 days, max cyclomatic complexity 48 in Texture::create_view_inner at line 1856. 5 of those changes were fix/bug commits, and the other 31 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-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 06:46:29 +00:00' --until='2026-09-27 06:46:29 +00:00' --full-history --no-merges -- wgpu-core/src/resource.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: wgpu/src/backend/wgpu_core.rs wgpu/src/backend/wgpu_core.rs:1023 — wgpu/src/backend/wgpu_core.rs changed 82 times in last 90 days, max cyclomatic complexity 19 in CoreDevice::create_bind_group at line 1023. 3 of those changes were fix/bug commits, and the other 79 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-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 06:46:29 +00:00' --until='2026-09-27 06:46:29 +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/msl/writer.rs naga/src/back/msl/writer.rs:2134 — naga/src/back/msl/writer.rs changed 7 times in last 90 days, max cyclomatic complexity 205 in Writer::put_expression at line 2134. 2 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-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 06:46:29 +00:00' --until='2026-09-27 06:46:29 +00:00' --full-history --no-merges -- naga/src/back/msl/writer.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: wgpu-hal/src/vulkan/adapter.rs wgpu-hal/src/vulkan/adapter.rs:1922 — wgpu-hal/src/vulkan/adapter.rs changed 18 times in last 90 days, max cyclomatic complexity 59 in InstanceShared::inspect at line 1922. 6 of those changes were fix/bug commits, and the other 12 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 06:46:29 +00:00' --until='2026-09-27 06:46:29 +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-core/src/validation.rs wgpu-core/src/validation.rs:1563 — wgpu-core/src/validation.rs changed 12 times in last 90 days, max cyclomatic complexity 85 in Interface::check_stage at line 1563. 6 of those changes were fix/bug commits, and the other 6 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-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 06:46:29 +00:00' --until='2026-09-27 06:46:29 +00:00' --full-history --no-merges -- wgpu-core/src/validation.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: naga/src/valid/interface.rs naga/src/valid/interface.rs:234 — naga/src/valid/interface.rs changed 7 times in last 90 days, max cyclomatic complexity 133 in VaryingContext::validate_impl at line 234. 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-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 06:46:29 +00:00' --until='2026-09-27 06:46:29 +00:00' --full-history --no-merges -- naga/src/valid/interface.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: naga/src/back/glsl/writer.rs naga/src/back/glsl/writer.rs:2430 — naga/src/back/glsl/writer.rs changed 3 times in last 90 days, max cyclomatic complexity 300 in Writer::write_expr at line 2430. 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-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 06:46:29 +00:00' --until='2026-09-27 06:46:29 +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-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, max 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-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 06:46:29 +00:00' --until='2026-09-27 06:46:29 +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/vulkan/conv.rs wgpu-hal/src/vulkan/conv.rs:6 — wgpu-hal/src/vulkan/conv.rs changed 7 times in last 90 days, max cyclomatic complexity 122 in PrivateCapabilities::map_texture_format at line 6. 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-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 06:46:29 +00:00' --until='2026-09-27 06:46:29 +00:00' --full-history --no-merges -- wgpu-hal/src/vulkan/conv.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: wgpu-hal/src/dx12/adapter.rs wgpu-hal/src/dx12/adapter.rs:65 — wgpu-hal/src/dx12/adapter.rs changed 8 times in last 90 days, max cyclomatic complexity 103 in Adapter::expose at line 65. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 06:46:29 +00:00' --until='2026-09-27 06:46:29 +00:00' --full-history --no-merges -- wgpu-hal/src/dx12/adapter.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: wgpu-core/src/device/trace/record.rs wgpu-core/src/device/trace/record.rs:875 — wgpu-core/src/device/trace/record.rs changed 13 times in last 90 days, max cyclomatic complexity 59 in wgpu_core::device::trace::record::action_to_owned at line 875. 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-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 06:46:29 +00:00' --until='2026-09-27 06:46:29 +00:00' --full-history --no-merges -- wgpu-core/src/device/trace/record.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, max cyclomatic complexity 249 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-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 06:46:29 +00:00' --until='2026-09-27 06:46:29 +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: wgpu-core/src/command/bundle.rs wgpu-core/src/command/bundle.rs:1503 — wgpu-core/src/command/bundle.rs changed 26 times in last 90 days, max cyclomatic complexity 26 in RenderBundle::execute at line 1503. 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-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 06:46:29 +00:00' --until='2026-09-27 06:46:29 +00:00' --full-history --no-merges -- wgpu-core/src/command/bundle.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: wgpu-hal/src/gles/adapter.rs wgpu-hal/src/gles/adapter.rs:195 — wgpu-hal/src/gles/adapter.rs changed 7 times in last 90 days, max 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-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 06:46:29 +00:00' --until='2026-09-27 06:46:29 +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: deno_webgpu/texture.rs deno_webgpu/texture.rs:496 — deno_webgpu/texture.rs changed 7 times in last 90 days, max cyclomatic complexity 95 in TextureFormat::from at line 496. 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-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 06:46:29 +00:00' --until='2026-09-27 06:46:29 +00:00' --full-history --no-merges -- deno_webgpu/texture.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: naga/src/front/wgsl/error.rs naga/src/front/wgsl/error.rs:678 — naga/src/front/wgsl/error.rs changed 5 times in last 90 days, max cyclomatic complexity 123 in Error::as_parse_error at line 678. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 06:46:29 +00:00' --until='2026-09-27 06:46:29 +00:00' --full-history --no-merges -- naga/src/front/wgsl/error.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: wgpu-core/src/command/ray_tracing.rs wgpu-core/src/command/ray_tracing.rs:588 — wgpu-core/src/command/ray_tracing.rs changed 12 times in last 90 days, max cyclomatic complexity 49 in wgpu_core::command::ray_tracing::iter_blas at line 588. 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-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 06:46:29 +00:00' --until='2026-09-27 06:46:29 +00:00' --full-history --no-merges -- wgpu-core/src/command/ray_tracing.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: wgpu-types/src/features.rs wgpu-types/src/features.rs:102 — wgpu-types/src/features.rs changed 7 times in last 90 days, max cyclomatic complexity 82 in Features::from_name at line 102. 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-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 06:46:29 +00:00' --until='2026-09-27 06:46:29 +00:00' --full-history --no-merges -- wgpu-types/src/features.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: wgpu-core/src/device/queue.rs wgpu-core/src/device/queue.rs:1511 — wgpu-core/src/device/queue.rs changed 23 times in last 90 days, max cyclomatic complexity 24 in Queue::submit_inner at line 1511. 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-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 06:46:29 +00:00' --until='2026-09-27 06:46:29 +00:00' --full-history --no-merges -- wgpu-core/src/device/queue.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: naga/src/back/hlsl/writer.rs naga/src/back/hlsl/writer.rs:3078 — naga/src/back/hlsl/writer.rs changed 4 times in last 90 days, max cyclomatic complexity 132 in Writer::write_math_expression at line 3078. 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-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 06:46:29 +00:00' --until='2026-09-27 06:46:29 +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.
  • + 40 more in this group — see findings.md.
D2 · Cognitive Complexity · Writer · ×60
  • Writer::write_functions (cognitive 543) naga/src/back/msl/writer.rs:6879 — Writer::write_functions has cognitive complexity 543 (threshold 15). Drivers by points: if/else 96 (316 pts), match/switch 33 (125 pts), loops 29 (86 pts), boolean chains 16 (nesting depth added 369). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • Writer::write_expr (cognitive 391) naga/src/back/glsl/writer.rs:2430 — Writer::write_expr has cognitive complexity 391 (threshold 15). Drivers by points: if/else 102 (235 pts), match/switch 49 (130 pts), boolean chains 15, loops 4 (11 pts) (nesting depth added 221). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Writer::write_stmt (cognitive 201) naga/src/back/hlsl/writer.rs:2198 — Writer::write_stmt has cognitive complexity 201 (threshold 15). Drivers by points: if/else 47 (117 pts), match/switch 23 (62 pts), loops 8 (20 pts), boolean chains 2 (nesting depth added 121). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Writer::write_expr (cognitive 196) naga/src/back/hlsl/writer.rs:3729 — Writer::write_expr has cognitive complexity 196 (threshold 15). Drivers by points: if/else 51 (113 pts), match/switch 28 (74 pts), boolean chains 7, loops 1 (2 pts) (nesting depth added 109). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Writer::write_stmt (cognitive 166) naga/src/back/glsl/writer.rs:1609 — Writer::write_stmt has cognitive complexity 166 (threshold 15). Drivers by points: if/else 36 (96 pts), match/switch 13 (34 pts), loops 10 (30 pts), boolean chains 6 (nesting depth added 101). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Writer::put_expression (cognitive 163) naga/src/back/msl/writer.rs:2134 — Writer::put_expression has cognitive complexity 163 (threshold 15). Drivers by points: if/else 40 (79 pts), match/switch 28 (71 pts), boolean chains 11, loops 1 (2 pts) (nesting depth added 83). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Writer::put_block (cognitive 158) naga/src/back/msl/writer.rs:3923 — Writer::put_block has cognitive complexity 158 (threshold 15). Drivers by points: if/else 37 (108 pts), match/switch 8 (26 pts), loops 8 (20 pts), boolean chains 4 (nesting depth added 101). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Writer::collect_required_features (cognitive 129) naga/src/back/glsl/features.rs:332 — Writer::collect_required_features has cognitive complexity 129 (threshold 15). Drivers by points: if/else 22 (79 pts), match/switch 8 (23 pts), boolean chains 14, loops 8 (13 pts) (nesting depth added 77). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • Writer::write_function (cognitive 122) naga/src/back/spv/writer.rs:1260 — Writer::write_function has cognitive complexity 122 (threshold 15). Drivers by points: if/else 47 (92 pts), loops 8 (14 pts), match/switch 6 (12 pts), boolean chains 4 (nesting depth added 57). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Writer::write_stmt (cognitive 120) naga/src/back/wgsl/writer.rs:746 — Writer::write_stmt has cognitive complexity 120 (threshold 15). Drivers by points: if/else 33 (75 pts), loops 10 (23 pts), match/switch 8 (19 pts), boolean chains 3 (nesting depth added 66). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Writer::write (cognitive 95) naga/src/back/glsl/writer.rs:132 — Writer::write has cognitive complexity 95 (threshold 15). Drivers by points: if/else 31 (63 pts), match/switch 6 (19 pts), boolean chains 7, loops 6 (nesting depth added 45). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Writer::write_function (cognitive 80) naga/src/back/hlsl/writer.rs:1629 — Writer::write_function has cognitive complexity 80 (threshold 15). Drivers by points: if/else 32 (59 pts), loops 5 (9 pts), match/switch 5 (8 pts), boolean chains 4 (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Writer::write_expr_plain_form (cognitive 77) naga/src/back/wgsl/writer.rs:1502 — Writer::write_expr_plain_form has cognitive complexity 77 (threshold 15). Drivers by points: if/else 20 (40 pts), match/switch 16 (31 pts), loops 2 (5 pts), boolean chains 1 (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Writer::write_math_expression (cognitive 72) naga/src/back/hlsl/writer.rs:3078 — Writer::write_math_expression has cognitive complexity 72 (threshold 15). Drivers by points: if/else 24 (46 pts), match/switch 12 (24 pts), boolean chains 2 (nesting depth added 34). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Writer::write_wrapped_functions (cognitive 68) naga/src/back/hlsl/help.rs:1844 — Writer::write_wrapped_functions has cognitive complexity 68 (threshold 15). Drivers by points: if/else 10 (35 pts), match/switch 10 (28 pts), loops 2 (5 pts) (nesting depth added 46). Of this number, 53 points are the body's own statements and 15 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Writer::write (cognitive 67) naga/src/back/hlsl/writer.rs:324 — Writer::write has cognitive complexity 67 (threshold 15). Drivers by points: if/else 18 (43 pts), loops 9 (12 pts), match/switch 3 (10 pts), boolean chains 2 (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Writer::write_std140_compat_type_declaration (cognitive 66) naga/src/back/spv/writer.rs:2345 — 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_entry_point_mesh_shader_info (cognitive 59) naga/src/back/spv/mesh_shader.rs:72 — Writer::write_entry_point_mesh_shader_info has cognitive complexity 59 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 8 (20 pts), match/switch 9 (19 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_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_logical_layout (cognitive 55) naga/src/back/spv/writer.rs:3713 — Writer::write_logical_layout has cognitive complexity 55 (threshold 15). Drivers by points: if/else 21 (33 pts), loops 12 (14 pts), boolean chains 4, match/switch 3 (4 pts) (nesting depth added 15). Of this number, 54 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Writer::write_global_variable (cognitive 52) naga/src/back/spv/writer.rs:3452 — 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:2033 — 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:3118 — Writer::map_binding has cognitive complexity 50 (threshold 15). Drivers by points: if/else 10 (23 pts), match/switch 8 (22 pts), boolean chains 5 (nesting depth added 27). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Writer::write_type_defs (cognitive 49) naga/src/back/msl/writer.rs:4703 — Writer::write_type_defs has cognitive complexity 49 (threshold 15). Drivers by points: if/else 11 (28 pts), match/switch 5 (13 pts), loops 4 (8 pts) (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Writer::write_wrapped_binary_ops (cognitive 44) naga/src/back/hlsl/help.rs:1593 — Writer::write_wrapped_binary_ops has cognitive complexity 44 (threshold 15). Drivers by points: if/else 7 (26 pts), match/switch 5 (17 pts), loops 1 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • + 35 more in this group — see findings.md.
D1 · Cyclomatic Complexity · Writer · ×47
  • Writer::write_expr (cyclomatic 300) naga/src/back/glsl/writer.rs:2430 — Writer::write_expr has cyclomatic complexity 300 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Writer::put_expression (cyclomatic 205) naga/src/back/msl/writer.rs:2134 — Writer::put_expression has cyclomatic complexity 205 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Writer::write_functions (cyclomatic 183) naga/src/back/msl/writer.rs:6879 — Writer::write_functions has cyclomatic complexity 183 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Writer::write_math_expression (cyclomatic 132) naga/src/back/hlsl/writer.rs:3078 — Writer::write_math_expression has cyclomatic complexity 132 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Writer::write_expr (cyclomatic 128) naga/src/back/hlsl/writer.rs:3729 — Writer::write_expr has cyclomatic complexity 128 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Writer::write_stmt (cyclomatic 122) naga/src/back/hlsl/writer.rs:2198 — Writer::write_stmt has cyclomatic complexity 122 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Writer::write_stmt (cyclomatic 103) naga/src/back/glsl/writer.rs:1609 — Writer::write_stmt has cyclomatic complexity 103 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Writer::put_block (cyclomatic 95) naga/src/back/msl/writer.rs:3923 — Writer::put_block has cyclomatic complexity 95 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Writer::write_stmt (cyclomatic 90) naga/src/back/wgsl/writer.rs:746 — Writer::write_stmt has cyclomatic complexity 90 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Writer::write_expr_plain_form (cyclomatic 80) naga/src/back/wgsl/writer.rs:1502 — Writer::write_expr_plain_form has cyclomatic complexity 80 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Writer::map_binding (cyclomatic 73) naga/src/back/spv/writer.rs:3118 — 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 54) naga/src/back/spv/writer.rs:1260 — Writer::write_function has cyclomatic complexity 54 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Writer::write (cyclomatic 47) naga/src/back/glsl/writer.rs:132 — Writer::write has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Writer::write_function (cyclomatic 40) naga/src/back/hlsl/writer.rs:1629 — Writer::write_function has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Writer::write_logical_layout (cyclomatic 40) naga/src/back/spv/writer.rs:3713 — Writer::write_logical_layout has cyclomatic complexity 40 (threshold 15). Of this number, 39 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Writer::write_enable_declarations (cyclomatic 38) naga/src/back/wgsl/writer.rs:287 — Writer::write_enable_declarations has cyclomatic complexity 38 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • Writer::write_wrapper_function (cyclomatic 33) naga/src/back/msl/mesh_shader.rs:149 — Writer::write_wrapper_function has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Writer::write (cyclomatic 33) naga/src/back/hlsl/writer.rs:324 — Writer::write has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Writer::write_wrapped_functions (cyclomatic 30) naga/src/back/hlsl/help.rs:1844 — Writer::write_wrapped_functions has cyclomatic complexity 30 (threshold 15). Of this number, 25 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Writer::write_global (cyclomatic 30) naga/src/back/hlsl/writer.rs:1024 — Writer::write_global has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Writer::write_entry_point_mesh_shader_info (cyclomatic 30) naga/src/back/spv/mesh_shader.rs:72 — Writer::write_entry_point_mesh_shader_info has cyclomatic complexity 30 (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:5964 — Writer::write_wrapped_binary_op has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Writer::write_unpacking_function (cyclomatic 43) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • Writer::write_image_load (cyclomatic 26) naga/src/back/glsl/writer.rs:4088 — Writer::write_image_load has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Writer::write_attributes_to (cyclomatic 26) naga/src/back/wgsl/writer.rs:592 — Writer::write_attributes_to has cyclomatic complexity 26 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • + 22 more in this group — see findings.md.
AX7 · Slice cohesion · Cross-slice coupling · ×40
  • Cross-slice coupling: deno_webgpu → wgpu deno_webgpu/adapter.rs:68 — `GPUAdapter` (slice 'deno_webgpu') depends on `Adapter` from slice 'wgpu'.
  • Cross-slice coupling: deno_webgpu → wgpu_types deno_webgpu/adapter.rs:348 — `GPUSupportedLimits` (slice 'deno_webgpu') depends on `Limits` from slice 'wgpu_types'.
  • Cross-slice coupling: deno_webgpu → wgpu_core_remote deno_webgpu/adapter.rs:548 — `GPUSupportedFeatures` (slice 'deno_webgpu') depends on `Global` from slice 'wgpu_core_remote'.
  • Cross-slice coupling: deno_webgpu → wgpu_types deno_webgpu/adapter.rs:587 — `GPUAdapterInfo` (slice 'deno_webgpu') depends on `AdapterInfo` from slice 'wgpu_types'.
  • Cross-slice coupling: deno_webgpu → wgpu deno_webgpu/bind_group.rs:26 — `GPUBindGroup` (slice 'deno_webgpu') depends on `BindGroup` from slice 'wgpu'.
  • Cross-slice coupling: deno_webgpu → wgpu deno_webgpu/bind_group_layout.rs:14 — `GPUBindGroupLayout` (slice 'deno_webgpu') depends on `BindGroupLayout` from slice 'wgpu'.
  • Cross-slice coupling: deno_webgpu → wgpu deno_webgpu/buffer.rs:63 — `GPUBuffer` (slice 'deno_webgpu') depends on `Buffer` from slice 'wgpu'.
  • Cross-slice coupling: deno_webgpu → wgpu deno_webgpu/byow.rs:94 — `UnsafeWindowSurface` (slice 'deno_webgpu') depends on `Surface` from slice 'wgpu'.
  • Cross-slice coupling: deno_webgpu → wgpu deno_webgpu/command_buffer.rs:12 — `GPUCommandBuffer` (slice 'deno_webgpu') depends on `CommandBuffer` from slice 'wgpu'.
  • Cross-slice coupling: deno_webgpu → wgpu deno_webgpu/command_encoder.rs:29 — `GPUCommandEncoder` (slice 'deno_webgpu') depends on `CommandEncoder` from slice 'wgpu'.
  • Cross-slice coupling: deno_webgpu → wgpu deno_webgpu/compute_pass.rs:20 — `GPUComputePassEncoder` (slice 'deno_webgpu') depends on `ComputePass` from slice 'wgpu'.
  • Cross-slice coupling: deno_webgpu → wgpu deno_webgpu/compute_pipeline.rs:18 — `GPUComputePipeline` (slice 'deno_webgpu') depends on `ComputePipeline` from slice 'wgpu'.
  • Cross-slice coupling: deno_webgpu → wgpu deno_webgpu/device.rs:46 — `GPUDevice` (slice 'deno_webgpu') depends on `Device` from slice 'wgpu'.
  • Cross-slice coupling: deno_webgpu → wgpu deno_webgpu/error.rs:42 — `DeviceErrorHandler` (slice 'deno_webgpu') depends on `Device` from slice 'wgpu'.
  • Cross-slice coupling: deno_webgpu → wgpu_core_remote deno_webgpu/lib.rs:152 — `EventTargetSetup` (slice 'deno_webgpu') depends on `Global` from slice 'wgpu_core_remote'.
  • Cross-slice coupling: deno_webgpu → wgpu_core_remote deno_webgpu/lib.rs:156 — `ErrorEventClass` (slice 'deno_webgpu') depends on `Global` from slice 'wgpu_core_remote'.
  • Cross-slice coupling: deno_webgpu → wgpu_core_remote deno_webgpu/lib.rs:157 — `PipelineErrorClass` (slice 'deno_webgpu') depends on `Global` from slice 'wgpu_core_remote'.
  • Cross-slice coupling: deno_webgpu → wgpu_core_remote deno_webgpu/lib.rs:286 — `WGSLLanguageFeatures` (slice 'deno_webgpu') depends on `Global` from slice 'wgpu_core_remote'.
  • Cross-slice coupling: deno_webgpu → wgpu deno_webgpu/pipeline_layout.rs:14 — `GPUPipelineLayout` (slice 'deno_webgpu') depends on `PipelineLayout` from slice 'wgpu'.
  • Cross-slice coupling: deno_webgpu → wgpu deno_webgpu/query_set.rs:14 — `GPUQuerySet` (slice 'deno_webgpu') depends on `QuerySet` from slice 'wgpu'.
  • Cross-slice coupling: deno_webgpu → wgpu deno_webgpu/queue.rs:26 — `GPUQueue` (slice 'deno_webgpu') depends on `Queue` from slice 'wgpu'.
  • Cross-slice coupling: deno_webgpu → wgpu deno_webgpu/render_bundle.rs:24 — `GPURenderBundleEncoder` (slice 'deno_webgpu') depends on `RenderBundleEncoder` from slice 'wgpu'.
  • Cross-slice coupling: deno_webgpu → wgpu deno_webgpu/render_bundle.rs:369 — `GPURenderBundle` (slice 'deno_webgpu') depends on `RenderBundle` from slice 'wgpu'.
  • Cross-slice coupling: deno_webgpu → wgpu deno_webgpu/render_pass.rs:30 — `GPURenderPassEncoder` (slice 'deno_webgpu') depends on `RenderPass` from slice 'wgpu'.
  • Cross-slice coupling: deno_webgpu → wgpu deno_webgpu/render_pipeline.rs:22 — `GPURenderPipeline` (slice 'deno_webgpu') depends on `RenderPipeline` from slice 'wgpu'.
  • + 15 more in this group — see findings.md.
D3 · God Classes · FunctionTooLong · ×28
  • FunctionTooLong: naga::front::glsl::builtins::inject_standard_builtins naga/src/front/glsl/builtins.rs:462 — FunctionTooLong — naga::front::glsl::builtins::inject_standard_builtins runs 398 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 298 over it, 3.98× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: wgpu_core::command::render::encode_render_pass wgpu-core/src/command/render.rs:2264 — FunctionTooLong — wgpu_core::command::render::encode_render_pass runs 373 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 273 over it, 3.73× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: wgpu_xtask::cts::run_cts xtask/src/cts.rs:66 — FunctionTooLong — wgpu_xtask::cts::run_cts runs 291 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 191 over it, 2.91× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: wgpu_core::device::trace::record::action_to_owned wgpu-core/src/device/trace/record.rs:875 — FunctionTooLong — wgpu_core::device::trace::record::action_to_owned runs 245 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 145 over it, 2.45× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: naga::back::dot::write_function_expressions naga/src/back/dot/mod.rs:571 — FunctionTooLong — naga::back::dot::write_function_expressions runs 228 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 128 over it, 2.28× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: naga::front::glsl::builtins::inject_builtin naga/src/front/glsl/builtins.rs:78 — FunctionTooLong — naga::front::glsl::builtins::inject_builtin runs 224 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 124 over it, 2.24× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: wgpu_core::command::compute::encode_compute_pass wgpu-core/src/command/compute.rs:622 — FunctionTooLong — wgpu_core::command::compute::encode_compute_pass runs 218 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 118 over it, 2.18× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: player::bin::play::main player/src/bin/play.rs:4 — FunctionTooLong — player::bin::play::main runs 211 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 111 over it, 2.11× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: naga::front::glsl::builtins::inject_common_builtin naga/src/front/glsl/builtins.rs:1220 — FunctionTooLong — naga::front::glsl::builtins::inject_common_builtin runs 207 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 107 over it, 2.07× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: wgpu_core::command::ray_tracing::build_acceleration_structures wgpu-core/src/command/ray_tracing.rs:195 — FunctionTooLong — wgpu_core::command::ray_tracing::build_acceleration_structures runs 196 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 96 over it, 1.96× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: naga::back::pipeline_constants::adjust_stmt naga/src/back/pipeline_constants.rs:721 — FunctionTooLong — naga::back::pipeline_constants::adjust_stmt runs 182 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 82 over it, 1.82× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: naga::back::pipeline_constants::adjust_expr naga/src/back/pipeline_constants.rs:488 — FunctionTooLong — naga::back::pipeline_constants::adjust_expr runs 181 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 81 over it, 1.81× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: naga::compact::compact naga/src/compact/mod.rs:68 — FunctionTooLong — naga::compact::compact runs 164 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 64 over it, 1.64× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: wgpu_info::human::print_adapter wgpu-info/src/human.rs:80 — FunctionTooLong — wgpu_info::human::print_adapter runs 159 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 59 over it, 1.59× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: naga::common::wgsl::types::try_write_type_inner naga/src/common/wgsl/types.rs:194 — FunctionTooLong — naga::common::wgsl::types::try_write_type_inner runs 157 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 57 over it, 1.57× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: naga_cli::bin::naga::write_output naga-cli/src/bin/naga.rs:826 — FunctionTooLong — naga_cli::bin::naga::write_output runs 145 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 45 over it, 1.45× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: wgpu_naga_bridge::features_to_naga_capabilities wgpu-naga-bridge/src/lib.rs:9 — FunctionTooLong — wgpu_naga_bridge::features_to_naga_capabilities runs 142 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 42 over it, 1.42× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: wgpu_core::command::render::multi_draw_indirect wgpu-core/src/command/render.rs:3211 — FunctionTooLong — wgpu_core::command::render::multi_draw_indirect runs 141 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 41 over it, 1.41× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: wgpu_core::command::compute::dispatch_workgroups_indirect wgpu-core/src/command/compute.rs:978 — FunctionTooLong — wgpu_core::command::compute::dispatch_workgroups_indirect runs 131 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 31 over it, 1.31× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: naga::front::glsl::types::parse_type naga/src/front/glsl/types.rs:9 — FunctionTooLong — naga::front::glsl::types::parse_type runs 127 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 27 over it, 1.27× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: naga::front::wgsl::parse::lexer::consume_token naga/src/front/wgsl/parse/lexer.rs:279 — FunctionTooLong — naga::front::wgsl::parse::lexer::consume_token runs 125 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 25 over it, 1.25× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: naga::front::wgsl::parse::conv::map_predeclared_type naga/src/front/wgsl/parse/conv.rs:448 — FunctionTooLong — naga::front::wgsl::parse::conv::map_predeclared_type runs 124 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 24 over it, 1.24× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: naga::front::wgsl::parse::number::parse naga/src/front/wgsl/parse/number.rs:88 — FunctionTooLong — naga::front::wgsl::parse::number::parse runs 122 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 22 over it, 1.22× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: lock_analyzer::main lock-analyzer/src/main.rs:29 — FunctionTooLong — lock_analyzer::main runs 119 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 19 over it, 1.19× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: naga::back::pipeline_constants::process_overrides naga/src/back/pipeline_constants.rs:71 — FunctionTooLong — naga::back::pipeline_constants::process_overrides runs 113 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 13 over it, 1.13× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • + 3 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×27
  • Duplicated block (7 lines × 2) deno_webgpu/lib.rs:395 — deno_webgpu/lib.rs:395-401 | deno_webgpu/lib.rs:438-444 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) naga/src/back/glsl/writer.rs:3460 — naga/src/back/glsl/writer.rs:3460-3466 | naga/src/back/glsl/writer.rs:3482-3488 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) naga/src/back/hlsl/help.rs:1245 — naga/src/back/hlsl/help.rs:1245-1251 | naga/src/back/msl/writer.rs:4874-4880 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) naga/src/back/hlsl/storage.rs:186 — naga/src/back/hlsl/storage.rs:186-192 | naga/src/back/hlsl/storage.rs:349-355 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) naga/src/back/hlsl/writer.rs:3503 — naga/src/back/hlsl/writer.rs:3503-3509 | naga/src/back/hlsl/writer.rs:3547-3553 — both copies are in the same file, so extract the block into 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:3821 — naga/src/back/hlsl/writer.rs:3821-3838 | naga/src/back/hlsl/writer.rs:3848-3854 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) naga/src/back/msl/writer.rs:6417 — naga/src/back/msl/writer.rs:6417-6423 | naga/src/back/msl/writer.rs:6634-6640 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) naga/src/front/spv/mod.rs:1006 — naga/src/front/spv/mod.rs:1006-1012 | naga/src/front/spv/mod.rs:1316-1322 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) naga/src/front/wgsl/lower/mod.rs:1487 — naga/src/front/wgsl/lower/mod.rs:1487-1493 | naga/src/front/wgsl/lower/mod.rs:2324-2330 — both copies are in the same file, so extract the block into 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:4714 — naga/src/front/wgsl/lower/mod.rs:4714-4720 | naga/src/front/wgsl/lower/mod.rs:4759-4765 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) naga/src/front/wgsl/parse/lexer.rs:395 — naga/src/front/wgsl/parse/lexer.rs:395-401 | naga/src/front/wgsl/parse/lexer.rs:404-410 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) naga/src/front/wgsl/parse/mod.rs:1654 — naga/src/front/wgsl/parse/mod.rs:1654-1660 | naga/src/front/wgsl/parse/mod.rs:1887-1893 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) naga/src/front/wgsl/parse/number.rs:457 — naga/src/front/wgsl/parse/number.rs:457-463 | naga/src/front/wgsl/parse/number.rs:474-480 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) naga/src/front/spv/next_block.rs:2437 — naga/src/front/spv/next_block.rs:2437-2443 | naga/src/front/spv/next_block.rs:2477-2483 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) wgpu-core/src/device/resource.rs:2525 — wgpu-core/src/device/resource.rs:2525-2531 | wgpu-core/src/device/resource.rs:2551-2557 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) wgpu-core/src/indirect_validation/dispatch.rs:87 — wgpu-core/src/indirect_validation/dispatch.rs:87-93 | wgpu-core/src/timestamp_normalization/mod.rs:143-150 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) wgpu-core/src/indirect_validation/dispatch.rs:287 — wgpu-core/src/indirect_validation/dispatch.rs:287-293 | 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 7 separate duplicated blocks between them, totalling at least 92 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 2) wgpu-hal/src/gles/device.rs:1685 — wgpu-hal/src/gles/device.rs:1685-1691 | wgpu-hal/src/gles/device.rs:1721-1727 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) wgpu-core/src/command/compute.rs:308 — wgpu-core/src/command/compute.rs:308-314 | wgpu-core/src/command/render.rs:722-728 — before extracting anything, compare `wgpu-core/src/command/compute.rs` and `wgpu-core/src/command/render.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 65 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 2) wgpu-core/src/pipeline.rs:660 — wgpu-core/src/pipeline.rs:660-666 | wgpu-core/src/resource.rs:3019-3025 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (7 lines × 2) naga/src/arena/mod.rs:212 — naga/src/arena/mod.rs:212-218 | naga/src/arena/unique_arena.rs:179-185 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (7 lines × 2) wgpu-core/src/command/compute.rs:1359 — wgpu-core/src/command/compute.rs:1359-1365 | wgpu-core/src/command/render.rs:4401-4407 — before extracting anything, compare `wgpu-core/src/command/compute.rs` and `wgpu-core/src/command/render.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 65 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 2) naga/src/back/glsl/writer.rs:1811 — naga/src/back/glsl/writer.rs:1811-1819 | naga/src/back/msl/writer.rs:4070-4076 — `naga/src/back/glsl/writer.rs` and `naga/src/back/msl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 66 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (7 lines × 2) wgpu-info/src/human.rs:31 — wgpu-info/src/human.rs:31-37 | wgpu-info/src/human.rs:44-50 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) naga/src/back/hlsl/writer.rs:3481 — naga/src/back/hlsl/writer.rs:3481-3487 | naga/src/back/hlsl/writer.rs:3495-3501 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 2 more in this group — see findings.md.
D2 · Cognitive Complexity · Device · ×26
  • Device::create_render_pipeline_or_error_inner (cognitive 233) wgpu-core/src/device/resource.rs:4655 — Device::create_render_pipeline_or_error_inner has cognitive complexity 233 (threshold 15). Drivers by points: if/else 85 (177 pts), loops 10 (25 pts), boolean chains 18, match/switch 11 (13 pts) (nesting depth added 109). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • Device::create_render_pipeline (cognitive 83) wgpu-hal/src/metal/device.rs:1425 — Device::create_render_pipeline has cognitive complexity 83 (threshold 15). Drivers by points: if/else 26 (49 pts), match/switch 16 (19 pts), loops 5 (13 pts), boolean chains 2 (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Device::create_pipeline_layout (cognitive 73) wgpu-hal/src/dx12/device.rs:970 — Device::create_pipeline_layout has cognitive complexity 73 (threshold 15). Drivers by points: if/else 21 (35 pts), match/switch 6 (22 pts), loops 8 (16 pts) (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Device::create_bind_group (cognitive 69) wgpu-hal/src/metal/device.rs:1090 — 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:903 — Device::create_pipeline_layout has cognitive complexity 60 (threshold 15). Drivers by points: if/else 11 (36 pts), loops 6 (12 pts), match/switch 2 (11 pts), boolean chains 1 (nesting depth added 40). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Device::validate_texture_descriptor_inner (cognitive 55) wgpu-core/src/device/resource.rs:1736 — Device::validate_texture_descriptor_inner has cognitive complexity 55 (threshold 15). Drivers by points: if/else 34 (47 pts), boolean chains 4, loops 2 (3 pts), match/switch 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Device::create_texture (cognitive 53) wgpu-hal/src/gles/device.rs:943 — Device::create_texture has cognitive complexity 53 (threshold 15). Drivers by points: if/else 17 (29 pts), loops 5 (21 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Device::create_bind_group_layout_impl (cognitive 47) wgpu-core/src/device/resource.rs:2978 — Device::create_bind_group_layout_impl has cognitive complexity 47 (threshold 15). Drivers by points: if/else 12 (26 pts), match/switch 6 (17 pts), boolean chains 2, loops 2 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Device::create_bind_group (cognitive 47) wgpu-hal/src/dx12/device.rs:1591 — Device::create_bind_group has cognitive complexity 47 (threshold 15). Drivers by points: loops 9 (25 pts), match/switch 4 (12 pts), if/else 6 (10 pts) (nesting depth added 28). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • Device::load_shader (cognitive 46) wgpu-hal/src/metal/device.rs:163 — Device::load_shader has cognitive complexity 46 (threshold 15). Drivers by points: match/switch 8 (27 pts), if/else 6 (15 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 29). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Device::create_render_pipeline (cognitive 45) wgpu-hal/src/dx12/device.rs:1997 — Device::create_render_pipeline has cognitive complexity 45 (threshold 15). Drivers by points: if/else 17 (26 pts), match/switch 8 (11 pts), loops 4 (8 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Device::create_render_pipeline (cognitive 39) wgpu-hal/src/vulkan/device.rs:1982 — 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:1152 — 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:831 — Device::deferred_resource_destruction has cognitive complexity 33 (threshold 15). Drivers by points: if/else 6 (24 pts), loops 3 (7 pts), match/switch 1 (2 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Device::create_buffer (cognitive 33) wgpu-hal/src/gles/device.rs:684 — Device::create_buffer has cognitive complexity 33 (threshold 15). Drivers by points: if/else 21 (29 pts), boolean chains 4 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Device::texture_use_parameters (cognitive 29) wgpu-core/src/device/resource.rs:4034 — Device::texture_use_parameters has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (23 pts), match/switch 3 (5 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Device::create_bind_group_layout (cognitive 29) wgpu-hal/src/vulkan/device.rs:1463 — Device::create_bind_group_layout has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (20 pts), match/switch 3 (7 pts), boolean chains 1, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Device::create_blas_inner (cognitive 27) wgpu-core/src/device/ray_tracing.rs:49 — Device::create_blas_inner has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 2 (4 pts), match/switch 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Device::maintain (cognitive 27) wgpu-core/src/device/resource.rs:938 — Device::maintain has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15 (19 pts), match/switch 4 (6 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • Device::create_bind_group_inner (cognitive 24) wgpu-core/src/device/resource.rs:3731 — Device::create_bind_group_inner has cognitive complexity 24 (threshold 15). Drivers by points: loops 8 (16 pts), match/switch 2 (5 pts), if/else 2 (3 pts) (nesting depth added 12). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • Device::create_program (cognitive 24) wgpu-hal/src/gles/device.rs:530 — Device::create_program has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (12 pts), loops 6 (8 pts), match/switch 2 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Device::create_texture_inner (cognitive 22) wgpu-core/src/device/resource.rs:2019 — Device::create_texture_inner has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 3 (10 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Device::create_texture_view (cognitive 22) wgpu-hal/src/metal/device.rs:616 — Device::create_texture_view has cognitive complexity 22 (threshold 15). Drivers by points: if/else 17 (20 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • Device::create_texture_view (cognitive 21) wgpu-hal/src/dx12/device.rs:656 — Device::create_texture_view has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14, match/switch 2 (4 pts), boolean chains 3 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • Device::create_buffer_binding (cognitive 17) wgpu-core/src/device/resource.rs:3267 — Device::create_buffer_binding has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (13 pts), match/switch 3, boolean chains 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • + 1 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (11 lines × 2) · ×25
  • Duplicated block (11 lines × 2) naga/src/back/glsl/writer.rs:3184 — naga/src/back/glsl/writer.rs:3184-3194 | naga/src/back/msl/writer.rs:2594-2604 — `naga/src/back/glsl/writer.rs` and `naga/src/back/msl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 66 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (11 lines × 2) naga/src/back/hlsl/writer.rs:1894 — naga/src/back/hlsl/writer.rs:1894-1904 | naga/src/back/wgsl/writer.rs:572-582 — `naga/src/back/hlsl/writer.rs` and `naga/src/back/wgsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 18 separate duplicated blocks between them, totalling at least 185 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (11 lines × 2) naga/src/back/hlsl/writer.rs:3560 — naga/src/back/hlsl/writer.rs:3560-3570 | naga/src/back/hlsl/writer.rs:3583-3593 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) naga/src/back/hlsl/writer.rs:4532 — naga/src/back/hlsl/writer.rs:4532-4542 | naga/src/back/wgsl/writer.rs:1903-1913 — `naga/src/back/hlsl/writer.rs` and `naga/src/back/wgsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 18 separate duplicated blocks between them, totalling at least 185 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (11 lines × 2) naga/src/back/pipeline_constants.rs:576 — naga/src/back/pipeline_constants.rs:576-586 | naga/src/back/pipeline_constants.rs:646-656 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) naga/src/back/spv/writer.rs:2228 — naga/src/back/spv/writer.rs:2228-2238 | naga/src/back/spv/writer.rs:2240-2250 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) naga/src/common/diagnostic_debug.rs:25 — naga/src/common/diagnostic_debug.rs:25-35 | naga/src/common/diagnostic_display.rs:80-90 — before extracting anything, compare `naga/src/common/diagnostic_debug.rs` and `naga/src/common/diagnostic_display.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 2) naga/src/front/glsl/builtins.rs:269 — naga/src/front/glsl/builtins.rs:269-279 | naga/src/front/glsl/builtins.rs:298-308 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) naga/src/proc/constant_evaluator.rs:3048 — naga/src/proc/constant_evaluator.rs:3048-3058 | naga/src/proc/constant_evaluator.rs:3093-3103 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) naga/src/valid/function.rs:1565 — naga/src/valid/function.rs:1565-1575 | naga/src/valid/function.rs:1776-1786 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) naga/src/valid/interface.rs:571 — naga/src/valid/interface.rs:571-581 | naga/src/valid/interface.rs:583-593 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) naga/src/valid/interface.rs:1391 — naga/src/valid/interface.rs:1391-1401 | naga/src/valid/interface.rs:1441-1451 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) 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) wgpu/src/backend/webgpu.rs:2169 — wgpu/src/backend/webgpu.rs:2169-2179 | wgpu/src/backend/webgpu.rs:2210-2220 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) wgpu/src/backend/wgpu_core.rs:1248 — wgpu/src/backend/wgpu_core.rs:1248-1258 | wgpu/src/backend/wgpu_core.rs:1331-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.
  • Duplicated block (11 lines × 2) wgpu/src/dispatch.rs:898 — wgpu/src/dispatch.rs:898-908 | wgpu/src/dispatch.rs:1050-1060 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) wgpu-core/src/track/buffer.rs:394 — wgpu-core/src/track/buffer.rs:394-404 | wgpu-core/src/track/buffer.rs:428-438 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) wgpu-hal/src/metal/command.rs:1329 — wgpu-hal/src/metal/command.rs:1329-1339 | wgpu-hal/src/metal/command.rs:1445-1455 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) wgpu-hal/src/gles/queue.rs:614 — wgpu-hal/src/gles/queue.rs:614-624 | wgpu-hal/src/gles/queue.rs:666-676 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) wgpu-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 7 separate duplicated blocks between them, totalling at least 92 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 2) naga-cli/src/bin/naga.rs:869 — naga-cli/src/bin/naga.rs:869-879 | naga-cli/src/bin/naga.rs:895-905 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) wgpu-core/src/indirect_validation/dispatch.rs:186 — wgpu-core/src/indirect_validation/dispatch.rs:186-196 | wgpu-core/src/indirect_validation/draw.rs:119-129 — before extracting anything, compare `wgpu-core/src/indirect_validation/dispatch.rs` and `wgpu-core/src/indirect_validation/draw.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 92 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 2) wgpu-hal/src/auxil/dxgi/dxgi_lib.rs:33 — wgpu-hal/src/auxil/dxgi/dxgi_lib.rs:33-43 | wgpu-hal/src/dx12/mod.rs:238-248 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (11 lines × 2) wgpu-core/src/indirect_validation/dispatch.rs:135 — wgpu-core/src/indirect_validation/dispatch.rs:135-145 | wgpu-core/src/indirect_validation/dispatch.rs:161-171 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) naga/src/back/msl/writer.rs:6043 — naga/src/back/msl/writer.rs:6043-6053 | naga/src/back/msl/writer.rs:6131-6141 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (8 lines × 2) · ×25
  • Duplicated block (8 lines × 2) naga/src/back/dot/mod.rs:221 — naga/src/back/dot/mod.rs:221-228 | naga/src/back/dot/mod.rs:266-273 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) naga/src/back/hlsl/help.rs:403 — naga/src/back/hlsl/help.rs:403-410 | naga/src/back/hlsl/help.rs:530-537 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) naga/src/back/msl/writer.rs:4328 — naga/src/back/msl/writer.rs:4328-4335 | naga/src/back/msl/writer.rs:4386-4393 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) naga/src/back/spv/block.rs:1724 — naga/src/back/spv/block.rs:1724-1731 | naga/src/back/spv/block.rs:1762-1769 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) naga/src/front/spv/mod.rs:2260 — naga/src/front/spv/mod.rs:2260-2267 | naga/src/front/spv/mod.rs:2315-2322 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) naga/src/front/wgsl/error.rs:100 — naga/src/front/wgsl/error.rs:100-107 | naga/src/span.rs:298-305 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8 lines × 2) naga/src/front/wgsl/error.rs:120 — naga/src/front/wgsl/error.rs:120-127 | naga/src/span.rs:323-330 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8 lines × 2) naga/src/front/wgsl/lower/mod.rs:3750 — naga/src/front/wgsl/lower/mod.rs:3750-3757 | naga/src/front/wgsl/lower/mod.rs:3764-3771 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) naga/src/proc/constant_evaluator.rs:2930 — naga/src/proc/constant_evaluator.rs:2930-2937 | naga/src/proc/constant_evaluator.rs:2993-3000 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) naga/src/proc/constant_evaluator.rs:2957 — naga/src/proc/constant_evaluator.rs:2957-2964 | naga/src/proc/constant_evaluator.rs:3017-3024 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) wgpu/src/backend/webgpu.rs:1146 — wgpu/src/backend/webgpu.rs:1146-1153 | wgpu/src/backend/webgpu.rs:1154-1161 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) wgpu-core/src/command/mod.rs:755 — wgpu-core/src/command/mod.rs:755-762 | wgpu-core/src/command/mod.rs:769-776 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) wgpu-core/src/command/query.rs:361 — wgpu-core/src/command/query.rs:361-368 | wgpu-core/src/command/query.rs:419-426 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) wgpu-core/src/command/ray_tracing.rs:765 — wgpu-core/src/command/ray_tracing.rs:765-772 | wgpu-core/src/command/ray_tracing.rs:852-859 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) wgpu-core/src/command/ray_tracing.rs:935 — wgpu-core/src/command/ray_tracing.rs:935-942 | wgpu-core/src/command/ray_tracing.rs:1064-1071 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) wgpu-core/src/device/resource.rs:1300 — wgpu-core/src/device/resource.rs:1300-1307 | wgpu-core/src/device/resource.rs:1667-1674 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) wgpu-hal/src/auxil/dxgi/dxgi_lib.rs:48 — wgpu-hal/src/auxil/dxgi/dxgi_lib.rs:48-55 | wgpu-hal/src/auxil/dxgi/dxgi_lib.rs:96-103 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) wgpu-hal/src/vulkan/device.rs:2241 — wgpu-hal/src/vulkan/device.rs:2241-2248 | wgpu-hal/src/vulkan/device.rs:2324-2331 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) wgpu/src/api/pipeline_cache.rs:78 — wgpu/src/api/pipeline_cache.rs:78-95 | wgpu/src/api/render_bundle.rs:19-26 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (8 lines × 2) wgpu/src/api/render_bundle_encoder.rs:95 — wgpu/src/api/render_bundle_encoder.rs:95-102 | wgpu/src/api/render_pass.rs:107-114 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (8 lines × 2) wgpu-core/src/pipeline.rs:340 — wgpu-core/src/pipeline.rs:340-347 | wgpu/src/backend/webgpu.rs:2025-2032 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8 lines × 2) naga/src/back/hlsl/help.rs:403 — naga/src/back/hlsl/help.rs:403-410 | naga/src/back/msl/writer.rs:6600-6608 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8 lines × 2) naga/src/back/msl/writer.rs:1347 — naga/src/back/msl/writer.rs:1347-1354 | naga/src/back/msl/writer.rs:3106-3113 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) naga/src/proc/namer.rs:326 — naga/src/proc/namer.rs:326-333 | naga/src/proc/namer.rs:357-364 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) naga/src/back/hlsl/storage.rs:198 — naga/src/back/hlsl/storage.rs:198-205 | naga/src/back/hlsl/storage.rs:218-225 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (6 lines × 2) · ×25
  • Duplicated block (6 lines × 2) naga/src/back/glsl/writer.rs:3537 — naga/src/back/glsl/writer.rs:3537-3542 | naga/src/back/hlsl/writer.rs:3312-3318 — `naga/src/back/glsl/writer.rs` and `naga/src/back/hlsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 86 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (6 lines × 2) naga/src/back/hlsl/writer.rs:3254 — naga/src/back/hlsl/writer.rs:3254-3259 | naga/src/back/hlsl/writer.rs:3285-3292 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) naga/src/back/hlsl/writer.rs:3872 — naga/src/back/hlsl/writer.rs:3872-3877 | naga/src/back/wgsl/writer.rs:1549-1554 — `naga/src/back/hlsl/writer.rs` and `naga/src/back/wgsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 18 separate duplicated blocks between them, totalling at least 185 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (6 lines × 2) naga/src/back/hlsl/writer.rs:4168 — naga/src/back/hlsl/writer.rs:4168-4173 | naga/src/back/wgsl/writer.rs:2012-2017 — `naga/src/back/hlsl/writer.rs` and `naga/src/back/wgsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 18 separate duplicated blocks between them, totalling at least 185 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (6 lines × 2) naga/src/back/msl/writer.rs:1938 — naga/src/back/msl/writer.rs:1938-1943 | naga/src/back/msl/writer.rs:1953-1958 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) naga/src/back/msl/writer.rs:7112 — naga/src/back/msl/writer.rs:7112-7117 | naga/src/back/msl/writer.rs:8338-8345 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) naga/src/back/spv/writer.rs:891 — naga/src/back/spv/writer.rs:891-896 | naga/src/back/spv/writer.rs:1123-1128 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) naga/src/front/spv/mod.rs:1211 — naga/src/front/spv/mod.rs:1211-1216 | naga/src/front/spv/mod.rs:1218-1223 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) naga/src/front/wgsl/lower/mod.rs:3395 — naga/src/front/wgsl/lower/mod.rs:3395-3400 | naga/src/front/wgsl/lower/mod.rs:3536-3541 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) naga/src/front/wgsl/parse/mod.rs:1182 — naga/src/front/wgsl/parse/mod.rs:1182-1187 | naga/src/front/wgsl/parse/mod.rs:1196-1201 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) naga/src/valid/analyzer.rs:715 — naga/src/valid/analyzer.rs:715-720 | naga/src/valid/analyzer.rs:741-746 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) naga/src/front/spv/next_block.rs:470 — naga/src/front/spv/next_block.rs:470-475 | naga/src/front/spv/next_block.rs:549-554 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) wgpu-core/src/binding_model.rs:1744 — wgpu-core/src/binding_model.rs:1744-1749 | wgpu-core/src/resource.rs:2582-2588 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (6 lines × 2) wgpu-core/src/pipeline.rs:589 — wgpu-core/src/pipeline.rs:589-594 | wgpu-core/src/pipeline.rs:1272-1277 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) wgpu-hal/src/vulkan/device.rs:2724 — wgpu-hal/src/vulkan/device.rs:2724-2730 | wgpu-hal/src/vulkan/device.rs:2793-2798 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) wgpu-hal/src/vulkan/instance.rs:130 — wgpu-hal/src/vulkan/instance.rs:130-135 | wgpu-hal/src/vulkan/instance.rs:143-148 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) wgpu-hal/src/dx12/mod.rs:1034 — wgpu-hal/src/dx12/mod.rs:1034-1039 | wgpu-hal/src/lib.rs:2320-2325 — 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:891-897 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) deno_webgpu/compute_pass.rs:202 — deno_webgpu/compute_pass.rs:202-207 | deno_webgpu/render_pass.rs:367-372 — before extracting anything, compare `deno_webgpu/compute_pass.rs` and `deno_webgpu/render_pass.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 70 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 2) wgpu/src/api/command_buffer.rs:41 — wgpu/src/api/command_buffer.rs:41-46 | wgpu/src/api/command_encoder.rs:453-458 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (6 lines × 2) naga/src/front/wgsl/parse/mod.rs:186 — naga/src/front/wgsl/parse/mod.rs:186-191 | naga/src/front/wgsl/parse/mod.rs:195-201 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) naga/src/back/glsl/writer.rs:3362 — naga/src/back/glsl/writer.rs:3362-3367 | naga/src/back/glsl/writer.rs:3393-3398 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) deno_webgpu/byow.rs:245 — deno_webgpu/byow.rs:245-250 | deno_webgpu/byow.rs:253-258 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) naga/src/back/msl/writer.rs:2409 — naga/src/back/msl/writer.rs:2409-2414 | naga/src/back/msl/writer.rs:2418-2423 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) naga/src/back/wgsl/writer.rs:928 — naga/src/back/wgsl/writer.rs:928-933 | naga/src/back/wgsl/writer.rs:1093-1098 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D3 · God Classes · ClassTooLong · ×23
  • ClassTooLong: Device wgpu-core/src/device/resource.rs:232 — ClassTooLong — 3634 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 101 methods, 6 blocks, lines 232-5884. The bar is 400 significant lines; this is 3234 over it, 9.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: Lowerer naga/src/front/wgsl/lower/mod.rs:1264 — ClassTooLong — 2559 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 37 methods, 2 blocks, lines 1264-5076. The bar is 400 significant lines; this is 2159 over it, 6.40× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ConstantEvaluator naga/src/proc/constant_evaluator.rs:683 — ClassTooLong — 1979 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 43 methods, 2 blocks, lines 683-3816. The bar is 400 significant lines; this is 1579 over it, 4.95× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Frontend naga/src/front/spv/mod.rs:612 — ClassTooLong — 1780 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-3221. The bar is 400 significant lines; this is 1380 over it, 4.45× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Writer naga/src/back/wgsl/writer.rs:82 — ClassTooLong — 1363 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 24 methods, 2 blocks, lines 82-2141. The bar is 400 significant lines; this is 963 over it, 3.41× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: TextureFormat wgpu-types/src/texture/format.rs:128 — ClassTooLong — 1218 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 29 methods, 4 blocks, lines 128-1937. The bar is 400 significant lines; this is 818 over it, 3.05× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Player player/src/lib.rs:28 — ClassTooLong — 1066 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 39 methods, 3 blocks, lines 28-1358. The bar is 400 significant lines; this is 666 over it, 2.67× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Queue wgpu-core/src/device/queue.rs:49 — ClassTooLong — 1032 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-2117. The bar is 400 significant lines; this is 632 over it, 2.58× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Error naga/src/front/wgsl/error.rs:335 — ClassTooLong — 1006 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 1 methods, 3 blocks, lines 335-1750. The bar is 400 significant lines; this is 606 over it, 2.52× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Context naga/src/front/glsl/context.rs:48 — ClassTooLong — 939 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 32 methods, 3 blocks, lines 48-1531. The bar is 400 significant lines; this is 539 over it, 2.35× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: RenderPass wgpu-core/src/command/render.rs:297 — 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 297-4567. 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:1290 — ClassTooLong — 644 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 1290-2909. The bar is 400 significant lines; this is 244 over it, 1.61× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: FunctionInfo naga/src/valid/analyzer.rs:240 — ClassTooLong — 623 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 10 methods, 5 blocks, lines 240-1235. The bar is 400 significant lines; this is 223 over it, 1.56× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: GPUDevice deno_webgpu/device.rs:46 — ClassTooLong — 591 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 46-896. The bar is 400 significant lines; this is 191 over it, 1.48× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Interface wgpu-core/src/validation.rs:376 — ClassTooLong — 590 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 5 methods, 2 blocks, lines 376-2105. The bar is 400 significant lines; this is 190 over it, 1.48× 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:220 — ClassTooLong — 540 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 6 methods, 4 blocks, lines 220-1601. The bar is 400 significant lines; this is 140 over it, 1.35× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: RenderBundleEncoder wgpu-core/src/command/bundle.rs:157 — ClassTooLong — 517 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 157-941. The bar is 400 significant lines; this is 117 over it, 1.29× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: VaryingContext naga/src/valid/interface.rs:219 — ClassTooLong — 507 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 2 methods, 2 blocks, lines 219-917. The bar is 400 significant lines; this is 107 over it, 1.27× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: RenderPassInfo wgpu-core/src/command/render.rs:1122 — 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 1122-1870. 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:1564 — ClassTooLong — 469 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 14 methods, 7 blocks, lines 1564-2455. The bar is 400 significant lines; this is 69 over it, 1.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Buffer wgpu-core/src/resource.rs:451 — ClassTooLong — 466 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 451-1240. The bar is 400 significant lines; this is 66 over it, 1.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ResolveContext naga/src/proc/typifier.rs:220 — ClassTooLong — 443 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 2 methods, 2 blocks, lines 220-826. The bar is 400 significant lines; this is 43 over it, 1.11× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Limits wgpu-types/src/limits.rs:144 — 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 144-1096. 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.
D3 · God Classes · TooManyMethods · ×23
  • TooManyMethods: Global wgpu-core-remote/src/global/mod.rs:39 — 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 — 108 methods, declared across 2 files: spv/instructions.rs (102), spv/layout.rs (6). The bar is 30 methods; this is 78 over it, 3.60× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Device wgpu-core/src/device/resource.rs:232 — TooManyMethods — 101 methods, declared across 4 files: device/resource.rs (87), src/error.rs (8), device/ray_tracing.rs (4), src/as_hal.rs (2). The bar is 30 methods; this is 71 over it, 3.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: Writer naga/src/back/hlsl/mod.rs:746 — TooManyMethods — 98 methods, declared across 5 files: hlsl/writer.rs (42), hlsl/help.rs (34), hlsl/ray.rs (11), hlsl/storage.rs (6), +1 more file(s). The bar is 30 methods; this is 68 over it, 3.27× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Writer naga/src/back/spv/mod.rs:921 — TooManyMethods — 97 methods, declared across 6 files: spv/writer.rs (74), spv/mesh_shader.rs (8), ray/query.rs (7), ray/mod.rs (4), +2 more file(s). The bar is 30 methods; this is 67 over it, 3.23× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Writer naga/src/back/msl/writer.rs:545 — TooManyMethods — 69 methods. The bar is 30 methods; this is 39 over it, 2.30× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Frontend naga/src/front/spv/mod.rs:612 — TooManyMethods — 69 methods, declared across 4 files: spv/mod.rs (58), spv/image.rs (7), spv/function.rs (3), spv/next_block.rs (1). The bar is 30 methods; this is 39 over it, 2.30× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: RenderPass wgpu-core/src/command/render.rs:297 — 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:826 — TooManyMethods — 57 methods, declared across 7 files: spv/block.rs (22), spv/image.rs (12), spv/index.rs (9), spv/mod.rs (8), +3 more file(s). The bar is 30 methods; this is 27 over it, 1.90× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Writer naga/src/back/glsl/writer.rs:5 — TooManyMethods — 48 methods, declared across 4 files: glsl/writer.rs (38), msl/ray.rs (5), glsl/features.rs (3), msl/mesh_shader.rs (2). The bar is 30 methods; this is 18 over it, 1.60× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Device wgpu/src/api/device.rs:21 — TooManyMethods — 46 methods. The bar is 30 methods; this is 16 over it, 1.53× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ConstantEvaluator naga/src/proc/constant_evaluator.rs:683 — TooManyMethods — 43 methods. The bar is 30 methods; this is 13 over it, 1.43× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Validator naga/src/valid/mod.rs:381 — TooManyMethods — 43 methods, declared across 6 files: valid/handles.rs (12), valid/function.rs (9), valid/mod.rs (9), valid/expression.rs (6), +2 more file(s). The bar is 30 methods; this is 13 over it, 1.43× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: CommandEncoder wgpu-core/src/command/mod.rs:510 — TooManyMethods — 43 methods, declared across 9 files: command/mod.rs (16), command/transfer.rs (8), command/clear.rs (4), command/query.rs (4), +5 more file(s). The bar is 30 methods; this is 13 over it, 1.43× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ParsingContext naga/src/front/glsl/parser.rs:24 — TooManyMethods — 40 methods, declared across 5 files: glsl/parser.rs (12), parser/types.rs (9), parser/expressions.rs (8), parser/declarations.rs (6), +1 more file(s). The bar is 30 methods; this is 10 over it, 1.33× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Parser naga/src/front/wgsl/parse/mod.rs:301 — TooManyMethods — 39 methods. The bar is 30 methods; this is 9 over it, 1.30× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Player player/src/lib.rs:28 — TooManyMethods — 39 methods. The bar is 30 methods; this is 9 over it, 1.30× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: GPUSupportedLimits deno_webgpu/adapter.rs:348 — TooManyMethods — 37 methods. The bar is 30 methods; this is 7 over it, 1.23× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Lowerer naga/src/front/wgsl/lower/mod.rs:1264 — TooManyMethods — 37 methods, declared across 2 files: lower/mod.rs (36), lower/construction.rs (1). The bar is 30 methods; this is 7 over it, 1.23× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ExpressionContext naga/src/front/wgsl/lower/mod.rs:369 — TooManyMethods — 34 methods, declared across 2 files: lower/mod.rs (25), lower/conversion.rs (9). The bar is 30 methods; this is 4 over it, 1.13× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Context naga/src/front/glsl/context.rs:48 — TooManyMethods — 32 methods, declared across 3 files: glsl/context.rs (25), glsl/types.rs (6), glsl/functions.rs (1). The bar is 30 methods; this is 2 over it, 1.07× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: 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.
  • TooManyMethods: TypeInner naga/src/ir/mod.rs:851 — TooManyMethods — 31 methods, declared across 7 files: proc/type_methods.rs (19), hlsl/conv.rs (3), proc/index.rs (3), lower/conversion.rs (2), +3 more file(s). The bar is 30 methods; this is 1 over it, 1.03× 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.
D4 · Code Duplication · Duplicated block (10 lines × 2) · ×23
  • Duplicated block (10 lines × 2) naga/src/back/glsl/writer.rs:1676 — naga/src/back/glsl/writer.rs:1676-1692 | naga/src/back/hlsl/writer.rs:2242-2251 — `naga/src/back/glsl/writer.rs` and `naga/src/back/hlsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 86 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (10 lines × 2) naga/src/back/msl/mod.rs:599 — naga/src/back/msl/mod.rs:599-608 | naga/src/back/msl/mod.rs:620-629 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) naga/src/back/msl/writer.rs:6089 — naga/src/back/msl/writer.rs:6089-6098 | naga/src/back/msl/writer.rs:6318-6327 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) naga/src/back/spv/instructions.rs:793 — naga/src/back/spv/instructions.rs:793-802 | naga/src/back/spv/instructions.rs:890-899 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) naga/src/back/wgsl/writer.rs:917 — naga/src/back/wgsl/writer.rs:917-926 | naga/src/back/wgsl/writer.rs:946-955 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) naga/src/front/glsl/builtins.rs:633 — naga/src/front/glsl/builtins.rs:633-642 | naga/src/front/glsl/builtins.rs:809-818 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) naga/src/front/glsl/builtins.rs:857 — naga/src/front/glsl/builtins.rs:857-866 | naga/src/front/glsl/builtins.rs:885-894 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) naga/src/front/glsl/builtins.rs:868 — naga/src/front/glsl/builtins.rs:868-877 | naga/src/front/glsl/builtins.rs:1196-1205 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) naga/src/front/wgsl/parse/number.rs:253 — naga/src/front/wgsl/parse/number.rs:253-262 | naga/src/front/wgsl/parse/number.rs:272-281 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) naga/src/proc/constant_evaluator.rs:2915 — naga/src/proc/constant_evaluator.rs:2915-2924 | naga/src/proc/constant_evaluator.rs:2978-2987 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) naga/src/valid/expression.rs:1371 — naga/src/valid/expression.rs:1371-1380 | naga/src/valid/expression.rs:1391-1401 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) naga/src/valid/function.rs:853 — naga/src/valid/function.rs:853-862 | naga/src/valid/function.rs:968-977 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) naga/src/valid/interface.rs:457 — naga/src/valid/interface.rs:457-466 | naga/src/valid/interface.rs:468-477 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) wgpu/src/backend/webgpu.rs:2635 — wgpu/src/backend/webgpu.rs:2635-2644 | wgpu/src/backend/webgpu.rs:4537-4546 — both copies are in the same file, so extract the block into 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:3859 — wgpu/src/backend/webgpu.rs:3859-3868 | wgpu/src/backend/webgpu.rs:4146-4155 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) wgpu/src/backend/wgpu_core.rs:1260 — wgpu/src/backend/wgpu_core.rs:1260-1269 | wgpu/src/backend/wgpu_core.rs:1343-1352 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) wgpu-core/src/pipeline.rs:522 — wgpu-core/src/pipeline.rs:522-531 | wgpu-core/src/pipeline.rs:1189-1198 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) wgpu-hal/src/dx12/command.rs:1033 — wgpu-hal/src/dx12/command.rs:1033-1042 | wgpu-hal/src/dx12/command.rs:1705-1714 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) wgpu-info/src/human.rs:320 — wgpu-info/src/human.rs:320-329 | wgpu-info/src/human.rs:349-358 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) wgpu-core/src/pipeline.rs:312 — wgpu-core/src/pipeline.rs:312-321 | wgpu/src/backend/webgpu.rs:1994-2003 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (10 lines × 2) naga/src/back/hlsl/writer.rs:4621 — naga/src/back/hlsl/writer.rs:4621-4630 | naga/src/back/wgsl/writer.rs:1922-1933 — `naga/src/back/hlsl/writer.rs` and `naga/src/back/wgsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 18 separate duplicated blocks between them, totalling at least 185 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (10 lines × 2) naga/src/back/hlsl/help.rs:2187 — naga/src/back/hlsl/help.rs:2187-2196 | naga/src/back/hlsl/help.rs:2200-2211 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) naga/src/back/glsl/writer.rs:4009 — naga/src/back/glsl/writer.rs:4009-4018 | naga/src/back/glsl/writer.rs:4059-4068 — both copies are in the same file, so extract the 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 (5 lines × 2) · ×22
  • Duplicated block (5 lines × 2) naga/src/back/glsl/writer.rs:760 — naga/src/back/glsl/writer.rs:760-765 | naga/src/back/glsl/writer.rs:828-832 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) naga/src/back/glsl/writer.rs:1771 — naga/src/back/glsl/writer.rs:1771-1775 | naga/src/back/hlsl/writer.rs:2165-2169 — `naga/src/back/glsl/writer.rs` and `naga/src/back/hlsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 86 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (5 lines × 2) naga/src/back/glsl/writer.rs:1851 — naga/src/back/glsl/writer.rs:1851-1855 | naga/src/back/hlsl/writer.rs:2619-2623 — `naga/src/back/glsl/writer.rs` and `naga/src/back/hlsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 86 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (5 lines × 2) naga/src/back/hlsl/writer.rs:2345 — naga/src/back/hlsl/writer.rs:2345-2349 | naga/src/back/hlsl/writer.rs:4810-4814 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) naga/src/back/msl/writer.rs:2861 — naga/src/back/msl/writer.rs:2861-2865 | naga/src/back/msl/writer.rs:2880-2884 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) naga/src/front/wgsl/error.rs:94 — naga/src/front/wgsl/error.rs:94-98 | naga/src/span.rs:292-296 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (5 lines × 2) naga/src/front/wgsl/lower/mod.rs:3654 — naga/src/front/wgsl/lower/mod.rs:3654-3658 | naga/src/front/wgsl/lower/mod.rs:3920-3924 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) naga/src/front/wgsl/lower/mod.rs:4472 — naga/src/front/wgsl/lower/mod.rs:4472-4476 | naga/src/front/wgsl/lower/mod.rs:5059-5063 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) naga/src/front/wgsl/parse/mod.rs:936 — naga/src/front/wgsl/parse/mod.rs:936-940 | naga/src/front/wgsl/parse/mod.rs:943-947 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) naga/src/front/wgsl/parse/number.rs:438 — naga/src/front/wgsl/parse/number.rs:438-443 | naga/src/front/wgsl/parse/number.rs:497-501 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) naga/src/proc/constant_evaluator.rs:3279 — naga/src/proc/constant_evaluator.rs:3279-3283 | naga/src/proc/constant_evaluator.rs:3350-3354 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) naga/src/front/spv/next_block.rs:1519 — naga/src/front/spv/next_block.rs:1519-1523 | naga/src/front/spv/next_block.rs:1526-1530 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) wgpu-core/src/pipeline.rs:516 — wgpu-core/src/pipeline.rs:516-520 | wgpu-core/src/pipeline.rs:1183-1187 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) naga/src/back/hlsl/writer.rs:3613 — naga/src/back/hlsl/writer.rs:3613-3617 | naga/src/back/wgsl/writer.rs:1402-1406 — `naga/src/back/hlsl/writer.rs` and `naga/src/back/wgsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 18 separate duplicated blocks between them, totalling at least 185 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (5 lines × 2) wgpu/src/api/render_bundle_encoder.rs:74 — wgpu/src/api/render_bundle_encoder.rs:74-78 | wgpu/src/api/render_pass.rs:76-81 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (5 lines × 2) naga/src/back/hlsl/writer.rs:3513 — naga/src/back/hlsl/writer.rs:3513-3520 | naga/src/back/hlsl/writer.rs:3530-3534 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) naga/src/back/hlsl/help.rs:337 — naga/src/back/hlsl/help.rs:337-341 | naga/src/back/hlsl/help.rs:432-439 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) naga/src/back/msl/writer.rs:4171 — naga/src/back/msl/writer.rs:4171-4176 | naga/src/back/wgsl/writer.rs:870-874 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (5 lines × 2) naga/src/back/hlsl/help.rs:1421 — naga/src/back/hlsl/help.rs:1421-1425 | naga/src/back/hlsl/help.rs:1473-1477 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) naga/src/back/msl/writer.rs:1458 — naga/src/back/msl/writer.rs:1458-1462 | naga/src/back/msl/writer.rs:1468-1472 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) naga/src/back/hlsl/writer.rs:2662 — naga/src/back/hlsl/writer.rs:2662-2666 | naga/src/back/wgsl/writer.rs:845-849 — `naga/src/back/hlsl/writer.rs` and `naga/src/back/wgsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 18 separate duplicated blocks between them, totalling at least 185 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (5 lines × 2) naga/src/back/glsl/writer.rs:3133 — naga/src/back/glsl/writer.rs:3133-3137 | naga/src/back/glsl/writer.rs:3476-3480 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D2 · Cognitive Complexity · naga · ×21
  • naga::front::glsl::builtins::inject_standard_builtins (cognitive 135) naga/src/front/glsl/builtins.rs:462 — naga::front::glsl::builtins::inject_standard_builtins has cognitive complexity 135 (threshold 15). Drivers by points: match/switch 43 (97 pts), loops 13 (26 pts), if/else 8 (12 pts) (nesting depth added 71). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • naga::front::glsl::builtins::inject_builtin (cognitive 87) naga/src/front/glsl/builtins.rs:78 — naga::front::glsl::builtins::inject_builtin has cognitive complexity 87 (threshold 15). Drivers by points: if/else 29 (57 pts), boolean chains 16, match/switch 6 (12 pts), loops 1 (2 pts) (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • naga::front::glsl::builtins::inject_common_builtin (cognitive 80) naga/src/front/glsl/builtins.rs:1220 — naga::front::glsl::builtins::inject_common_builtin has cognitive complexity 80 (threshold 15). Drivers by points: match/switch 23 (55 pts), loops 10 (21 pts), if/else 1 (3 pts), boolean chains 1 (nesting depth added 45). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • naga::compact::compact (cognitive 78) naga/src/compact/mod.rs:68 — naga::compact::compact has cognitive complexity 78 (threshold 15). Drivers by points: if/else 35 (60 pts), loops 10 (15 pts), boolean chains 3 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • naga::front::wgsl::parse::number::parse (cognitive 67) naga/src/front/wgsl/parse/number.rs:88 — naga::front::wgsl::parse::number::parse has cognitive complexity 67 (threshold 15). Drivers by points: if/else 22 (55 pts), match/switch 6 (9 pts), loops 2, boolean chains 1 (nesting depth added 36). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • naga::back::dot::write_function_expressions (cognitive 56) naga/src/back/dot/mod.rs:571 — naga::back::dot::write_function_expressions has cognitive complexity 56 (threshold 15). Drivers by points: if/else 15 (32 pts), match/switch 7 (18 pts), loops 3 (6 pts) (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • naga::common::wgsl::types::try_write_type_inner (cognitive 48) naga/src/common/wgsl/types.rs:194 — naga::common::wgsl::types::try_write_type_inner has cognitive complexity 48 (threshold 15). Drivers by points: if/else 23 (42 pts), match/switch 4 (6 pts) (nesting depth added 21). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • naga::front::wgsl::parse::lexer::consume_token (cognitive 48) naga/src/front/wgsl/parse/lexer.rs:279 — naga::front::wgsl::parse::lexer::consume_token has cognitive complexity 48 (threshold 15). Drivers by points: match/switch 16 (37 pts), if/else 2 (7 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 28). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • naga::front::glsl::builtins::inject_double_builtin (cognitive 46) naga/src/front/glsl/builtins.rs:1047 — naga::front::glsl::builtins::inject_double_builtin has cognitive complexity 46 (threshold 15). Drivers by points: match/switch 14 (36 pts), loops 5 (10 pts) (nesting depth added 27). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • naga::back::pipeline_constants::process_overrides (cognitive 41) naga/src/back/pipeline_constants.rs:71 — naga::back::pipeline_constants::process_overrides has cognitive complexity 41 (threshold 15). Drivers by points: if/else 12 (23 pts), loops 8 (11 pts), match/switch 2 (4 pts), boolean chains 3 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • naga::back::pipeline_constants::map_value_to_literal (cognitive 32) naga/src/back/pipeline_constants.rs:1035 — naga::back::pipeline_constants::map_value_to_literal has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (26 pts), boolean chains 5, match/switch 1 (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • naga::back::pipeline_constants::adjust_stmt (cognitive 31) naga/src/back/pipeline_constants.rs:721 — naga::back::pipeline_constants::adjust_stmt has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (16 pts), match/switch 5 (9 pts), loops 3 (6 pts) (nesting depth added 15). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • naga::valid::compose::validate_compose (cognitive 29) naga/src/valid/compose.rs:15 — naga::valid::compose::validate_compose has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 4 (8 pts), match/switch 2 (4 pts) (nesting depth added 16). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • naga::front::glsl::builtins::texture_args_generator (cognitive 27) naga/src/front/glsl/builtins.rs:2322 — naga::front::glsl::builtins::texture_args_generator has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 3 (6 pts), boolean chains 4 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • naga::back::pipeline_constants::adjust_expr (cognitive 24) naga/src/back/pipeline_constants.rs:488 — naga::back::pipeline_constants::adjust_expr has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (17 pts), match/switch 3 (5 pts), loops 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • naga::front::wgsl::parse::number::parse_hex_float_parts (cognitive 24) naga/src/front/wgsl/parse/number.rs:436 — naga::front::wgsl::parse::number::parse_hex_float_parts has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (8 pts), match/switch 6 (8 pts), loops 4 (5 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • naga::back::pipeline_constants::filter_emits_in_block (cognitive 23) naga/src/back/pipeline_constants.rs:962 — naga::back::pipeline_constants::filter_emits_in_block has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 3 (7 pts), match/switch 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • naga::front::wgsl::parse::number::convert_hex_float (cognitive 23) naga/src/front/wgsl/parse/number.rs:560 — naga::front::wgsl::parse::number::convert_hex_float has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • naga::front::glsl::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::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::proc::index::oob_local_types (cognitive 16) naga/src/proc/index.rs:413 — naga::proc::index::oob_local_types has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 2 (4 pts), match/switch 1 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D1 · Cyclomatic Complexity · Device · ×19
  • Device::create_render_pipeline_or_error_inner (cyclomatic 122) wgpu-core/src/device/resource.rs:4655 — Device::create_render_pipeline_or_error_inner has cyclomatic complexity 122 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Device::create_render_pipeline (cyclomatic 46) wgpu-hal/src/metal/device.rs:1425 — Device::create_render_pipeline has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Device::validate_texture_descriptor_inner (cyclomatic 41) wgpu-core/src/device/resource.rs:1736 — Device::validate_texture_descriptor_inner has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Device::create_pipeline_layout (cyclomatic 38) wgpu-hal/src/dx12/device.rs:970 — Device::create_pipeline_layout has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Device::create_bind_group_layout_impl (cyclomatic 34) wgpu-core/src/device/resource.rs:2978 — Device::create_bind_group_layout_impl has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Device::load_shader (cyclomatic 29) wgpu-hal/src/metal/device.rs:163 — Device::load_shader has cyclomatic complexity 29 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: wgpu_hal::metal::device::convert_vertex_format_to_naga (cyclomatic 43) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • Device::create_buffer_inner (cyclomatic 27) wgpu-core/src/device/resource.rs:1152 — Device::create_buffer_inner has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • Device::create_render_pipeline (cyclomatic 26) wgpu-hal/src/dx12/device.rs:1997 — Device::create_render_pipeline has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Device::create_pipeline_layout (cyclomatic 26) wgpu-hal/src/metal/device.rs:903 — 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:1982 — Device::create_render_pipeline has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Device::texture_use_parameters (cyclomatic 23) wgpu-core/src/device/resource.rs:4034 — Device::texture_use_parameters has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Device::create_bind_group (cyclomatic 23) wgpu-hal/src/dx12/device.rs:1591 — Device::create_bind_group has cyclomatic complexity 23 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • Device::create_bind_group (cyclomatic 23) wgpu-hal/src/metal/device.rs:1090 — 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:3731 — Device::create_bind_group_inner has cyclomatic complexity 20 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • Device::create_buffer (cyclomatic 20) wgpu-hal/src/gles/device.rs:684 — Device::create_buffer has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Device::create_texture (cyclomatic 20) wgpu-hal/src/gles/device.rs:943 — Device::create_texture has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Device::maintain (cyclomatic 18) wgpu-core/src/device/resource.rs:938 — 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:1463 — Device::create_bind_group_layout has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · naga · ×18
  • naga::front::glsl::builtins::inject_standard_builtins (cyclomatic 177) naga/src/front/glsl/builtins.rs:462 — naga::front::glsl::builtins::inject_standard_builtins has cyclomatic complexity 177 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • naga::front::glsl::builtins::inject_common_builtin (cyclomatic 91) naga/src/front/glsl/builtins.rs:1220 — naga::front::glsl::builtins::inject_common_builtin has cyclomatic complexity 91 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • naga::front::wgsl::parse::conv::map_predeclared_type (cyclomatic 91) naga/src/front/wgsl/parse/conv.rs:448 — naga::front::wgsl::parse::conv::map_predeclared_type has cyclomatic complexity 91 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • naga::front::glsl::builtins::inject_builtin (cyclomatic 70) naga/src/front/glsl/builtins.rs:78 — naga::front::glsl::builtins::inject_builtin has cyclomatic complexity 70 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • naga::back::dot::write_function_expressions (cyclomatic 60) naga/src/back/dot/mod.rs:571 — naga::back::dot::write_function_expressions has cyclomatic complexity 60 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • naga::front::wgsl::parse::lexer::consume_token (cyclomatic 47) naga/src/front/wgsl/parse/lexer.rs:279 — naga::front::wgsl::parse::lexer::consume_token has cyclomatic complexity 47 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • naga::compact::compact (cyclomatic 44) naga/src/compact/mod.rs:68 — naga::compact::compact has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • naga::front::glsl::builtins::inject_double_builtin (cyclomatic 44) naga/src/front/glsl/builtins.rs:1047 — naga::front::glsl::builtins::inject_double_builtin has cyclomatic complexity 44 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • naga::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_stmt (cyclomatic 39) naga/src/back/pipeline_constants.rs:721 — naga::back::pipeline_constants::adjust_stmt has cyclomatic complexity 39 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • naga::common::wgsl::types::try_write_type_inner (cyclomatic 38) naga/src/common/wgsl/types.rs:194 — naga::common::wgsl::types::try_write_type_inner has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • naga::back::pipeline_constants::adjust_expr (cyclomatic 36) naga/src/back/pipeline_constants.rs:488 — naga::back::pipeline_constants::adjust_expr has cyclomatic complexity 36 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • naga::back::glsl::conv::glsl_built_in (cyclomatic 33) naga/src/back/glsl/conv.rs:69 — naga::back::glsl::conv::glsl_built_in has cyclomatic complexity 33 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: naga::back::glsl::conv::glsl_storage_format (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • naga::front::wgsl::parse::number::parse_hex_float_parts (cyclomatic 30) naga/src/front/wgsl/parse/number.rs:436 — naga::front::wgsl::parse::number::parse_hex_float_parts has cyclomatic complexity 30 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • naga::back::pipeline_constants::map_value_to_literal (cyclomatic 28) naga/src/back/pipeline_constants.rs:1035 — naga::back::pipeline_constants::map_value_to_literal has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • naga::front::wgsl::parse::number::parse (cyclomatic 26) naga/src/front/wgsl/parse/number.rs:88 — naga::front::wgsl::parse::number::parse has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • naga::back::pipeline_constants::process_overrides (cyclomatic 25) naga/src/back/pipeline_constants.rs:71 — naga::back::pipeline_constants::process_overrides has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • naga::valid::compose::validate_compose (cyclomatic 18) naga/src/valid/compose.rs:15 — naga::valid::compose::validate_compose has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D2 · Cognitive Complexity · Frontend · ×18
  • Frontend::next_block (cognitive 350) naga/src/front/spv/next_block.rs:22 — Frontend::next_block has cognitive complexity 350 (threshold 15). Drivers by points: if/else 72 (168 pts), match/switch 36 (123 pts), loops 18 (56 pts), boolean chains 3 (nesting depth added 221). Of this number, 349 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Frontend::process_entry_point (cognitive 76) naga/src/front/spv/function.rs:320 — Frontend::process_entry_point has cognitive complexity 76 (threshold 15). Drivers by points: if/else 15 (58 pts), loops 6 (12 pts), match/switch 3 (6 pts) (nesting depth added 52). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • Frontend::function_call (cognitive 68) naga/src/front/glsl/functions.rs:515 — Frontend::function_call has cognitive complexity 68 (threshold 15). Drivers by points: if/else 16 (37 pts), match/switch 7 (20 pts), loops 5 (7 pts), boolean chains 4 (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Frontend::parse_image_sample (cognitive 55) naga/src/front/spv/image.rs:490 — Frontend::parse_image_sample has cognitive complexity 55 (threshold 15). Drivers by points: if/else 17 (27 pts), match/switch 13 (23 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Frontend::add_global_var (cognitive 41) naga/src/front/glsl/variables.rs:415 — Frontend::add_global_var has cognitive complexity 41 (threshold 15). Drivers by points: if/else 8 (23 pts), match/switch 7 (18 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Frontend::parse_global_variable (cognitive 38) naga/src/front/spv/mod.rs:2951 — Frontend::parse_global_variable has cognitive complexity 38 (threshold 15). Drivers by points: match/switch 7 (18 pts), if/else 10 (15 pts), loops 1 (4 pts), boolean chains 1 (nesting depth added 19). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Frontend::field_selection (cognitive 34) naga/src/front/glsl/variables.rs:244 — Frontend::field_selection has cognitive complexity 34 (threshold 15). Drivers by points: if/else 6 (16 pts), match/switch 5 (11 pts), loops 2 (7 pts) (nesting depth added 21). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Frontend::parse_function (cognitive 31) naga/src/front/spv/function.rs:28 — Frontend::parse_function has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 5 (9 pts), match/switch 3 (6 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Frontend::handle_directive (cognitive 30) naga/src/front/glsl/parser.rs:248 — Frontend::handle_directive has cognitive complexity 30 (threshold 15). Drivers by points: match/switch 9 (20 pts), if/else 4 (10 pts) (nesting depth added 17). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Frontend::parse (cognitive 26) naga/src/front/spv/mod.rs:1714 — Frontend::parse has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 7 (10 pts), match/switch 2 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Frontend::matrix_one_arg (cognitive 24) naga/src/front/glsl/functions.rs:211 — Frontend::matrix_one_arg has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (11 pts), match/switch 4 (9 pts), loops 2 (4 pts) (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Frontend::constructor_many (cognitive 23) naga/src/front/glsl/functions.rs:414 — Frontend::constructor_many has cognitive complexity 23 (threshold 15). Drivers by points: loops 5 (12 pts), if/else 3 (7 pts), match/switch 2 (4 pts) (nesting depth added 13). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • Frontend::process_lhs_argument (cognitive 22) naga/src/front/glsl/functions.rs:873 — Frontend::process_lhs_argument has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (16 pts), loops 1 (3 pts), match/switch 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Frontend::patch_statements (cognitive 22) naga/src/front/spv/mod.rs:1584 — Frontend::patch_statements has cognitive complexity 22 (threshold 15). Drivers by points: match/switch 3 (10 pts), loops 3 (7 pts), if/else 1 (5 pts) (nesting depth added 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Frontend::coordinate_components (cognitive 20) naga/src/front/glsl/builtins.rs:2113 — Frontend::coordinate_components has cognitive complexity 20 (threshold 15). Drivers by points: match/switch 5 (10 pts), if/else 6 (9 pts), boolean chains 1 (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Frontend::parse_execution_mode (cognitive 19) naga/src/front/spv/mod.rs:1954 — Frontend::parse_execution_mode has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (18 pts), match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Frontend::constructor_single (cognitive 17) naga/src/front/glsl/functions.rs:61 — Frontend::constructor_single has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 3, boolean chains 1 (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Frontend::parse_image_load (cognitive 16) naga/src/front/spv/image.rs:366 — Frontend::parse_image_load has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (7 pts), match/switch 3 (5 pts), loops 2 (4 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication · Duplicated block (12 lines × 2) · ×16
  • Duplicated block (12 lines × 2) deno_webgpu/buffer.rs:167 — deno_webgpu/buffer.rs:167-178 | deno_webgpu/queue.rs:86-97 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (12 lines × 2) naga/src/back/glsl/writer.rs:2474 — naga/src/back/glsl/writer.rs:2474-2485 | naga/src/back/wgsl/writer.rs:1569-1580 — `naga/src/back/glsl/writer.rs` and `naga/src/back/wgsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 135 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (12 lines × 2) naga/src/back/wgsl/writer.rs:1623 — naga/src/back/wgsl/writer.rs:1623-1634 | naga/src/back/wgsl/writer.rs:1697-1708 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) naga/src/common/diagnostic_debug.rs:74 — naga/src/common/diagnostic_debug.rs:74-85 | naga/src/common/diagnostic_display.rs:112-123 — before extracting anything, compare `naga/src/common/diagnostic_debug.rs` and `naga/src/common/diagnostic_display.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 2) naga/src/front/glsl/builtins.rs:1305 — naga/src/front/glsl/builtins.rs:1305-1316 | naga/src/front/glsl/builtins.rs:1416-1427 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) naga/src/front/glsl/functions.rs:1076 — naga/src/front/glsl/functions.rs:1076-1087 | naga/src/front/glsl/functions.rs:1158-1169 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) naga/src/front/wgsl/lower/mod.rs:1713 — naga/src/front/wgsl/lower/mod.rs:1713-1724 | naga/src/front/wgsl/lower/mod.rs:1728-1739 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) naga/src/valid/function.rs:712 — naga/src/valid/function.rs:712-723 | naga/src/valid/function.rs:775-786 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) player/src/lib.rs:1014 — player/src/lib.rs:1014-1025 | player/src/lib.rs:1169-1180 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) wgpu/src/api/command_encoder.rs:432 — wgpu/src/api/command_encoder.rs:432-443 | wgpu/src/api/compute_pass.rs:139-150 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (12 lines × 2) wgpu/src/api/render_bundle_encoder.rs:122 — wgpu/src/api/render_bundle_encoder.rs:122-133 | wgpu/src/api/render_pass.rs:136-147 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (12 lines × 2) wgpu-core/src/device/resource.rs:464 — wgpu-core/src/device/resource.rs:464-475 | wgpu-core/src/device/resource.rs:483-494 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) wgpu-core/src/indirect_validation/dispatch.rs:150 — wgpu-core/src/indirect_validation/dispatch.rs:150-161 | wgpu-core/src/indirect_validation/dispatch.rs:176-187 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) wgpu-core/src/track/texture.rs:1231 — wgpu-core/src/track/texture.rs:1231-1242 | wgpu-core/src/track/texture.rs:1483-1494 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) wgpu-hal/src/metal/command.rs:400 — wgpu-hal/src/metal/command.rs:400-411 | wgpu-hal/src/metal/command.rs:415-426 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) wgpu-types/src/write_only.rs:539 — wgpu-types/src/write_only.rs:539-550 | wgpu-types/src/write_only.rs:552-563 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×16
  • Duplicated block (9 lines × 2) naga/src/back/hlsl/writer.rs:2235 — naga/src/back/hlsl/writer.rs:2235-2243 | naga/src/back/wgsl/writer.rs:957-965 — `naga/src/back/hlsl/writer.rs` and `naga/src/back/wgsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 18 separate duplicated blocks between them, totalling at least 185 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (9 lines × 2) naga/src/back/hlsl/writer.rs:2594 — naga/src/back/hlsl/writer.rs:2594-2602 | naga/src/back/msl/writer.rs:4086-4094 — `naga/src/back/hlsl/writer.rs` and `naga/src/back/msl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 37 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (9 lines × 2) naga/src/back/hlsl/writer.rs:3671 — naga/src/back/hlsl/writer.rs:3671-3679 | naga/src/back/wgsl/writer.rs:1457-1465 — `naga/src/back/hlsl/writer.rs` and `naga/src/back/wgsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 18 separate duplicated blocks between them, totalling at least 185 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (9 lines × 2) naga/src/front/wgsl/lower/mod.rs:3660 — naga/src/front/wgsl/lower/mod.rs:3660-3668 | naga/src/front/wgsl/lower/mod.rs:3927-3935 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) naga/src/front/wgsl/parse/mod.rs:917 — naga/src/front/wgsl/parse/mod.rs:917-925 | naga/src/front/wgsl/parse/mod.rs:1738-1746 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) naga/src/valid/analyzer.rs:735 — naga/src/valid/analyzer.rs:735-743 | naga/src/valid/analyzer.rs:794-802 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) wgpu-core/src/command/compute.rs:579 — wgpu-core/src/command/compute.rs:579-587 | wgpu-core/src/command/render.rs:2219-2227 — before extracting anything, compare `wgpu-core/src/command/compute.rs` and `wgpu-core/src/command/render.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 65 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 2) wgpu-core/src/command/transfer.rs:907 — wgpu-core/src/command/transfer.rs:907-915 | wgpu-core/src/command/transfer.rs:958-966 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) wgpu-core/src/indirect_validation/dispatch.rs:220 — wgpu-core/src/indirect_validation/dispatch.rs:220-228 | wgpu-core/src/indirect_validation/draw.rs:630-638 — 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 7 separate duplicated blocks between them, totalling at least 92 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 2) wgpu-core/src/indirect_validation/dispatch.rs:230 — wgpu-core/src/indirect_validation/dispatch.rs:230-238 | wgpu-core/src/timestamp_normalization/mod.rs:234-242 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (9 lines × 2) wgpu-hal/src/gles/command.rs:502 — wgpu-hal/src/gles/command.rs:502-510 | wgpu-hal/src/gles/command.rs:1224-1232 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) wgpu-hal/src/gles/device.rs:144 — wgpu-hal/src/gles/device.rs:144-152 | wgpu-hal/src/gles/device.rs:170-178 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) wgpu-hal/src/metal/command.rs:673 — wgpu-hal/src/metal/command.rs:673-681 | wgpu-hal/src/metal/command.rs:718-726 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) naga/src/back/hlsl/help.rs:1521 — naga/src/back/hlsl/help.rs:1521-1530 | naga/src/back/hlsl/help.rs:1572-1580 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) naga/src/proc/namer.rs:378 — naga/src/proc/namer.rs:378-386 | naga/src/proc/namer.rs:393-401 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) naga/src/front/wgsl/parse/mod.rs:1941 — naga/src/front/wgsl/parse/mod.rs:1941-1949 | naga/src/front/wgsl/parse/mod.rs:1982-1990 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D2 · Cognitive Complexity · CommandEncoder · ×15
  • CommandEncoder::begin_render_pass_inner::fill_arc_desc (cognitive 74) wgpu-core/src/command/render.rs:1886 — CommandEncoder::begin_render_pass_inner::fill_arc_desc has cognitive complexity 74 (threshold 15). Drivers by points: if/else 28 (61 pts), match/switch 2 (8 pts), boolean chains 4, loops 1 (nesting depth added 39). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • CommandEncoder::begin_render_pass (cognitive 57) wgpu-hal/src/gles/command.rs:498 — CommandEncoder::begin_render_pass has cognitive complexity 57 (threshold 15). Drivers by points: if/else 18 (41 pts), match/switch 4 (8 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CommandEncoder::begin_render_pass (cognitive 51) wgpu-hal/src/metal/command.rs:895 — CommandEncoder::begin_render_pass has cognitive complexity 51 (threshold 15). Drivers by points: if/else 28 (47 pts), loops 3 (4 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CommandEncoder::begin_render_pass (cognitive 39) wgpu-hal/src/dx12/command.rs:1026 — CommandEncoder::begin_render_pass has cognitive complexity 39 (threshold 15). Drivers by points: if/else 19 (33 pts), boolean chains 4, loops 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CommandEncoder::push_barrier (cognitive 34) wgpu-hal/src/dx12/command.rs:90 — CommandEncoder::push_barrier has cognitive complexity 34 (threshold 15). Drivers by points: loops 3 (12 pts), match/switch 3 (12 pts), if/else 7 (10 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CommandEncoder::set_render_pipeline (cognitive 33) wgpu-hal/src/gles/command.rs:872 — CommandEncoder::set_render_pipeline has cognitive complexity 33 (threshold 15). Drivers by points: if/else 16 (21 pts), loops 6 (11 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • CommandEncoder::transition_textures (cognitive 28) wgpu-hal/src/dx12/command.rs:642 — CommandEncoder::transition_textures has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (26 pts), boolean chains 1, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CommandEncoder::set_render_pipeline (cognitive 25) wgpu-hal/src/metal/command.rs:1290 — CommandEncoder::set_render_pipeline has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (17 pts), loops 2 (4 pts), match/switch 4 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CommandEncoder::rebind_vertex_data (cognitive 24) wgpu-hal/src/gles/command.rs:134 — CommandEncoder::rebind_vertex_data has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (11 pts), match/switch 3 (9 pts), loops 2 (4 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CommandEncoder::build_acceleration_structures (cognitive 24) wgpu-hal/src/vulkan/command.rs:566 — CommandEncoder::build_acceleration_structures has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 4 (8 pts), match/switch 3 (5 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CommandEncoder::update_bind_group_state (cognitive 21) wgpu-hal/src/metal/command.rs:311 — CommandEncoder::update_bind_group_state has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 4 (6 pts), match/switch 5 (6 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CommandEncoder::encode_commands (cognitive 18) wgpu-core/src/command/mod.rs:1085 — CommandEncoder::encode_commands has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 4 (11 pts), if/else 5 (6 pts), loops 1 (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • CommandEncoder::update_root_elements (cognitive 18) wgpu-hal/src/dx12/command.rs:271 — CommandEncoder::update_root_elements has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 7 (11 pts), loops 3 (7 pts) (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • CommandEncoder::begin_render_pass (cognitive 18) wgpu-hal/src/vulkan/command.rs:824 — CommandEncoder::begin_render_pass has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (17 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.
  • CommandEncoder::set_immediates (cognitive 17) wgpu-hal/src/metal/command.rs:1201 — CommandEncoder::set_immediates has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (17 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D17 · Explicit Debt · HackComment · ×14
  • HackComment naga/src/back/msl/writer.rs:3648 — // 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.
  • 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/spv/block.rs:3766 — // HACK the loop statement is begin with branch instruction, — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment naga/src/back/spv/block.rs:4028 — // HACK: SPIR-V doesn't have a atomic subtraction, — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment naga/src/front/spv/next_block.rs:245 — // HACK `OpAccessChain` and `OpInBoundsAccessChain` — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment naga/src/front/spv/next_block.rs:1977 — // HACK(eddyb) Naga doesn't seem to have this helper, — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment naga/src/front/spv/next_block.rs:2001 — // HACK(eddyb) this has to go to the parent *twice*, because — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment naga/src/front/spv/next_block.rs:2030 — // HACK(eddyb) since Naga doesn't explicitly track — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment naga/src/front/spv/mod.rs:2401 — // HACK if the underlying type is an image or a sampler, let's assume — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment naga/src/front/spv/mod.rs:2482 — // HACK same case as in `parse_type_array()` — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment naga/src/valid/type.rs:753 — // HACK: this could be nicer. We want to allow some structures — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment naga/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 wgpu-core/src/instance.rs:719 — // 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 wgpu-hal/src/gles/mod.rs:521 — // HACK: detect a cube map; forces cube compatible textures to be cube textures — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
D1 · Cyclomatic Complexity · Frontend · ×13
  • Frontend::next_block (cyclomatic 291) naga/src/front/spv/next_block.rs:22 — Frontend::next_block has cyclomatic complexity 291 (threshold 15). Of this number, 289 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Frontend::parse (cyclomatic 53) naga/src/front/spv/mod.rs:1714 — Frontend::parse has cyclomatic complexity 53 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Frontend::parse_image_sample (cyclomatic 41) naga/src/front/spv/image.rs:490 — Frontend::parse_image_sample has cyclomatic complexity 41 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Frontend::function_call (cyclomatic 37) naga/src/front/glsl/functions.rs:515 — Frontend::function_call has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Frontend::lookup_variable (cyclomatic 28) naga/src/front/glsl/variables.rs:101 — Frontend::lookup_variable has cyclomatic complexity 28 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Frontend::process_entry_point (cyclomatic 25) naga/src/front/spv/function.rs:320 — Frontend::process_entry_point has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Frontend::parse_global_variable (cyclomatic 23) naga/src/front/spv/mod.rs:2951 — Frontend::parse_global_variable has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: Frontend::next_decoration (cyclomatic 25) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • Frontend::handle_directive (cyclomatic 20) naga/src/front/glsl/parser.rs:248 — Frontend::handle_directive has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Frontend::add_global_var (cyclomatic 20) naga/src/front/glsl/variables.rs:415 — Frontend::add_global_var has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Frontend::parse_function (cyclomatic 19) naga/src/front/spv/function.rs:28 — Frontend::parse_function has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Frontend::field_selection (cyclomatic 17) naga/src/front/glsl/variables.rs:244 — Frontend::field_selection has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • Frontend::patch_statements (cyclomatic 17) naga/src/front/spv/mod.rs:1584 — Frontend::patch_statements has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: Frontend::next_decoration (cyclomatic 25) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • Frontend::constructor_single (cyclomatic 16) naga/src/front/glsl/functions.rs:61 — Frontend::constructor_single has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D4 · Code Duplication · Duplicated block (13 lines × 2) · ×12
  • Duplicated block (13 lines × 2) deno_webgpu/webidl.rs:54 — deno_webgpu/webidl.rs:54-66 | deno_webgpu/webidl.rs:164-176 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) naga/src/back/hlsl/help.rs:2231 — naga/src/back/hlsl/help.rs:2231-2243 | naga/src/back/hlsl/help.rs:2249-2261 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) naga/src/back/hlsl/storage.rs:357 — naga/src/back/hlsl/storage.rs:357-369 | naga/src/back/hlsl/storage.rs:377-389 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) naga/src/back/hlsl/writer.rs:3326 — naga/src/back/hlsl/writer.rs:3326-3338 | naga/src/back/msl/writer.rs:1867-1879 — `naga/src/back/hlsl/writer.rs` and `naga/src/back/msl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 37 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (13 lines × 2) naga/src/back/spv/mesh_shader.rs:790 — naga/src/back/spv/mesh_shader.rs:790-802 | naga/src/back/spv/mesh_shader.rs:861-873 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) naga/src/common/diagnostic_debug.rs:57 — naga/src/common/diagnostic_debug.rs:57-69 | naga/src/common/diagnostic_display.rs:61-73 — before extracting anything, compare `naga/src/common/diagnostic_debug.rs` and `naga/src/common/diagnostic_display.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 2) naga/src/front/wgsl/lower/mod.rs:3515 — naga/src/front/wgsl/lower/mod.rs:3515-3527 | naga/src/front/wgsl/lower/mod.rs:3554-3566 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) wgpu-core/src/command/render.rs:3256 — wgpu-core/src/command/render.rs:3256-3268 | wgpu-core/src/command/render.rs:3476-3488 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) wgpu-core/src/pipeline.rs:275 — wgpu-core/src/pipeline.rs:275-287 | wgpu-core/src/pipeline.rs:326-338 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) wgpu-core/src/track/texture.rs:1521 — wgpu-core/src/track/texture.rs:1521-1533 | wgpu-core/src/track/texture.rs:1570-1582 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) wgpu-hal/src/vulkan/device.rs:2362 — wgpu-hal/src/vulkan/device.rs:2362-2374 | wgpu-hal/src/vulkan/device.rs:2379-2391 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) naga-cli/src/bin/naga.rs:949 — naga-cli/src/bin/naga.rs:949-961 | naga-cli/src/bin/naga.rs:984-996 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D2 · Cognitive Complexity · Validator · ×11
  • Validator::validate_block_impl (cognitive 338) naga/src/valid/function.rs:789 — Validator::validate_block_impl has cognitive complexity 338 (threshold 15). Drivers by points: if/else 55 (183 pts), match/switch 37 (134 pts), loops 7 (19 pts), boolean chains 2 (nesting depth added 237). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Validator::validate_expression (cognitive 295) naga/src/valid/expression.rs:382 — Validator::validate_expression has cognitive complexity 295 (threshold 15). Drivers by points: match/switch 68 (170 pts), if/else 51 (110 pts), boolean chains 9, loops 3 (6 pts) (nesting depth added 164). Of this number, 293 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Validator::validate_type (cognitive 157) naga/src/valid/type.rs:383 — Validator::validate_type has cognitive complexity 157 (threshold 15). Drivers by points: if/else 48 (119 pts), match/switch 12 (28 pts), boolean chains 8, loops 1 (2 pts) (nesting depth added 88). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Validator::validate_entry_point (cognitive 119) naga/src/valid/interface.rs:1257 — Validator::validate_entry_point has cognitive complexity 119 (threshold 15). Drivers by points: if/else 43 (96 pts), match/switch 10 (19 pts), boolean chains 2, loops 2 (nesting depth added 62). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • Validator::validate_global_var (cognitive 72) naga/src/valid/interface.rs:920 — Validator::validate_global_var has cognitive complexity 72 (threshold 15). Drivers by points: if/else 24 (51 pts), match/switch 8 (18 pts), boolean chains 3 (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Validator::validate_module_handles (cognitive 65) naga/src/valid/handles.rs:34 — Validator::validate_module_handles has cognitive complexity 65 (threshold 15). Drivers by points: loops 21 (37 pts), if/else 15 (25 pts), match/switch 1 (3 pts) (nesting depth added 28). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • Validator::validate_atomic (cognitive 51) naga/src/valid/function.rs:424 — Validator::validate_atomic has cognitive complexity 51 (threshold 15). Drivers by points: if/else 23 (48 pts), match/switch 2, boolean chains 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Validator::validate_function (cognitive 32) naga/src/valid/function.rs:1875 — Validator::validate_function has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (22 pts), match/switch 2 (5 pts), loops 3, boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Validator::check_width (cognitive 31) naga/src/valid/type.rs:289 — Validator::check_width has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (28 pts), match/switch 2 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Validator::validate_block_handles (cognitive 18) naga/src/valid/handles.rs:680 — Validator::validate_block_handles has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 5 (9 pts), loops 3 (6 pts), if/else 2 (3 pts) (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Validator::validate_impl (cognitive 18) naga/src/valid/mod.rs:765 — Validator::validate_impl has cognitive complexity 18 (threshold 15). Drivers by points: loops 8 (11 pts), match/switch 2 (4 pts), if/else 2 (3 pts) (nesting depth added 6). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D4 · Code Duplication · Duplicated block (15 lines × 2) · ×11
  • Duplicated block (15 lines × 2) naga/src/back/glsl/writer.rs:244 — naga/src/back/glsl/writer.rs:244-258 | naga/src/back/msl/writer.rs:4883-4897 — `naga/src/back/glsl/writer.rs` and `naga/src/back/msl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 66 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (15 lines × 2) naga/src/back/glsl/writer.rs:2486 — naga/src/back/glsl/writer.rs:2486-2500 | naga/src/back/wgsl/writer.rs:1582-1596 — `naga/src/back/glsl/writer.rs` and `naga/src/back/wgsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 135 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (15 lines × 2) naga/src/back/hlsl/help.rs:1132 — naga/src/back/hlsl/help.rs:1132-1146 | naga/src/back/hlsl/help.rs:1209-1223 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) naga/src/back/hlsl/help.rs:1638 — naga/src/back/hlsl/help.rs:1638-1652 | naga/src/back/hlsl/help.rs:1703-1717 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) naga/src/back/hlsl/writer.rs:2936 — naga/src/back/hlsl/writer.rs:2936-2950 | naga/src/back/hlsl/writer.rs:3000-3014 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) naga/src/front/glsl/builtins.rs:666 — naga/src/front/glsl/builtins.rs:666-680 | naga/src/front/glsl/builtins.rs:1061-1075 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) naga/src/front/glsl/builtins.rs:1448 — naga/src/front/glsl/builtins.rs:1448-1462 | naga/src/front/glsl/builtins.rs:1477-1491 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) naga/src/valid/analyzer.rs:450 — naga/src/valid/analyzer.rs:450-464 | naga/src/valid/analyzer.rs:466-480 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) naga/src/valid/expression.rs:801 — naga/src/valid/expression.rs:801-815 | naga/src/valid/expression.rs:816-830 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) naga/src/valid/interface.rs:505 — naga/src/valid/interface.rs:505-519 | naga/src/valid/interface.rs:521-535 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) wgpu/src/backend/webgpu.rs:3836 — wgpu/src/backend/webgpu.rs:3836-3850 | wgpu/src/backend/webgpu.rs:4123-4137 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D1 · Cyclomatic Complexity · Validator · ×10
  • Validator::validate_expression (cyclomatic 211) naga/src/valid/expression.rs:382 — Validator::validate_expression has cyclomatic complexity 211 (threshold 15). Of this number, 205 points are the body's own statements and 6 belong to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Validator::validate_block_impl (cyclomatic 133) naga/src/valid/function.rs:789 — Validator::validate_block_impl has cyclomatic complexity 133 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Validator::validate_type (cyclomatic 83) naga/src/valid/type.rs:383 — Validator::validate_type has cyclomatic complexity 83 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Validator::validate_entry_point (cyclomatic 79) naga/src/valid/interface.rs:1257 — Validator::validate_entry_point has cyclomatic complexity 79 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Validator::validate_global_var (cyclomatic 50) naga/src/valid/interface.rs:920 — Validator::validate_global_var has cyclomatic complexity 50 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Validator::validate_module_handles (cyclomatic 38) naga/src/valid/handles.rs:34 — Validator::validate_module_handles has cyclomatic complexity 38 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • Validator::validate_block_handles (cyclomatic 33) naga/src/valid/handles.rs:680 — Validator::validate_block_handles has cyclomatic complexity 33 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: Validator::validate_expression_handles (cyclomatic 34) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • Validator::validate_atomic (cyclomatic 25) naga/src/valid/function.rs:424 — Validator::validate_atomic has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Validator::validate_function (cyclomatic 19) naga/src/valid/function.rs:1875 — Validator::validate_function has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Validator::check_width (cyclomatic 18) naga/src/valid/type.rs:289 — Validator::check_width has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CommandEncoder · ×10
  • CommandEncoder::begin_render_pass (cyclomatic 34) wgpu-hal/src/gles/command.rs:498 — CommandEncoder::begin_render_pass has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • CommandEncoder::update_bind_group_state (cyclomatic 31) wgpu-hal/src/metal/command.rs:311 — CommandEncoder::update_bind_group_state has cyclomatic complexity 31 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • CommandEncoder::begin_render_pass_inner::fill_arc_desc (cyclomatic 30) wgpu-core/src/command/render.rs:1886 — CommandEncoder::begin_render_pass_inner::fill_arc_desc has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • CommandEncoder::begin_render_pass (cyclomatic 27) wgpu-hal/src/metal/command.rs:895 — CommandEncoder::begin_render_pass has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • CommandEncoder::encode_commands (cyclomatic 23) wgpu-core/src/command/mod.rs:1085 — CommandEncoder::encode_commands has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • CommandEncoder::begin_render_pass (cyclomatic 23) wgpu-hal/src/dx12/command.rs:1026 — CommandEncoder::begin_render_pass has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • CommandEncoder::update_root_elements (cyclomatic 22) wgpu-hal/src/dx12/command.rs:271 — CommandEncoder::update_root_elements has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • CommandEncoder::set_render_pipeline (cyclomatic 21) wgpu-hal/src/gles/command.rs:872 — CommandEncoder::set_render_pipeline has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • CommandEncoder::push_barrier (cyclomatic 18) wgpu-hal/src/dx12/command.rs:90 — CommandEncoder::push_barrier has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • CommandEncoder::set_render_pipeline (cyclomatic 18) wgpu-hal/src/metal/command.rs:1290 — CommandEncoder::set_render_pipeline has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D4 · Code Duplication · Duplicated block (16 lines × 2) · ×10
  • Duplicated block (16 lines × 2) naga/src/back/glsl/writer.rs:1622 — naga/src/back/glsl/writer.rs:1622-1637 | naga/src/back/hlsl/writer.rs:2211-2226 — `naga/src/back/glsl/writer.rs` and `naga/src/back/hlsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 86 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (16 lines × 2) naga/src/back/hlsl/help.rs:1401 — naga/src/back/hlsl/help.rs:1401-1416 | naga/src/back/hlsl/help.rs:1443-1458 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) naga/src/back/spv/image.rs:623 — naga/src/back/spv/image.rs:623-638 | naga/src/back/spv/image.rs:646-661 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) naga/src/back/spv/mesh_shader.rs:912 — naga/src/back/spv/mesh_shader.rs:912-927 | naga/src/back/spv/mesh_shader.rs:935-950 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) naga/src/front/glsl/parser.rs:274 — naga/src/front/glsl/parser.rs:274-289 | naga/src/front/glsl/parser.rs:352-367 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) naga/src/valid/interface.rs:537 — naga/src/valid/interface.rs:537-552 | naga/src/valid/interface.rs:554-569 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) wgpu-core/src/indirect_validation/dispatch.rs:88 — wgpu-core/src/indirect_validation/dispatch.rs:88-103 | wgpu-core/src/indirect_validation/draw.rs:555-570 — before extracting anything, compare `wgpu-core/src/indirect_validation/dispatch.rs` and `wgpu-core/src/indirect_validation/draw.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 92 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (16 lines × 2) wgpu-core/src/track/texture.rs:1256 — wgpu-core/src/track/texture.rs:1256-1271 | wgpu-core/src/track/texture.rs:1500-1515 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) wgpu-hal/src/metal/conv.rs:443 — wgpu-hal/src/metal/conv.rs:443-458 | wgpu-hal/src/metal/conv.rs:474-489 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) naga/src/back/msl/writer.rs:6430 — naga/src/back/msl/writer.rs:6430-6445 | naga/src/back/msl/writer.rs:6525-6542 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D1 · Cyclomatic Complexity · wgpu_core · ×9
  • wgpu_core::command::ray_tracing::iter_blas (cyclomatic 49) wgpu-core/src/command/ray_tracing.rs:588 — wgpu_core::command::ray_tracing::iter_blas has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • wgpu_core::command::render::encode_render_pass (cyclomatic 29) wgpu-core/src/command/render.rs:2264 — wgpu_core::command::render::encode_render_pass has cyclomatic complexity 29 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • wgpu_core::track::texture::update (cyclomatic 21) wgpu-core/src/track/texture.rs:1460 — wgpu_core::track::texture::update has cyclomatic complexity 21 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • wgpu_core::command::ray_tracing::build_acceleration_structures (cyclomatic 20) wgpu-core/src/command/ray_tracing.rs:195 — wgpu_core::command::ray_tracing::build_acceleration_structures has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • wgpu_core::track::texture::barrier (cyclomatic 18) wgpu-core/src/track/texture.rs:1341 — wgpu_core::track::texture::barrier has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • wgpu_core::command::compute::encode_compute_pass (cyclomatic 17) wgpu-core/src/command/compute.rs:622 — wgpu_core::command::compute::encode_compute_pass has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • wgpu_core::device::surface_config::validate_surface_configuration (cyclomatic 17) wgpu-core/src/device/surface_config.rs:44 — wgpu_core::device::surface_config::validate_surface_configuration has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • wgpu_core::track::texture::merge (cyclomatic 17) wgpu-core/src/track/texture.rs:1207 — wgpu_core::track::texture::merge has cyclomatic complexity 17 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • wgpu_core::command::transfer::copy_texture_to_texture (cyclomatic 16) wgpu-core/src/command/transfer.rs:1453 — wgpu_core::command::transfer::copy_texture_to_texture has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · wgpu_core · ×9
  • wgpu_core::command::ray_tracing::iter_blas (cognitive 158) wgpu-core/src/command/ray_tracing.rs:588 — wgpu_core::command::ray_tracing::iter_blas has cognitive complexity 158 (threshold 15). Drivers by points: if/else 36 (131 pts), match/switch 4 (14 pts), loops 3 (7 pts), boolean chains 6 (nesting depth added 109). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • wgpu_core::track::texture::update (cognitive 58) wgpu-core/src/track/texture.rs:1460 — wgpu_core::track::texture::update has cognitive complexity 58 (threshold 15). Drivers by points: loops 10 (35 pts), if/else 5 (20 pts), match/switch 2, boolean chains 1 (nesting depth added 40). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • wgpu_core::track::texture::barrier (cognitive 44) wgpu-core/src/track/texture.rs:1341 — wgpu_core::track::texture::barrier has cognitive complexity 44 (threshold 15). Drivers by points: if/else 7 (26 pts), loops 6 (16 pts), boolean chains 1, match/switch 1 (nesting depth added 29). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • wgpu_core::track::texture::merge (cognitive 43) wgpu-core/src/track/texture.rs:1207 — wgpu_core::track::texture::merge has cognitive complexity 43 (threshold 15). Drivers by points: loops 8 (23 pts), if/else 5 (19 pts), match/switch 1 (nesting depth added 29). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • wgpu_core::command::ray_tracing::build_acceleration_structures (cognitive 37) wgpu-core/src/command/ray_tracing.rs:195 — wgpu_core::command::ray_tracing::build_acceleration_structures has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (26 pts), loops 5 (7 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • wgpu_core::device::surface_config::validate_surface_configuration (cognitive 21) wgpu-core/src/device/surface_config.rs:44 — wgpu_core::device::surface_config::validate_surface_configuration has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (13 pts), match/switch 2 (4 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
  • wgpu_core::command::transfer::copy_texture_to_texture (cognitive 18) wgpu-core/src/command/transfer.rs:1453 — wgpu_core::command::transfer::copy_texture_to_texture has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 5 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • wgpu_core::command::render::multi_draw_indirect (cognitive 17) wgpu-core/src/command/render.rs:3211 — 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.
  • wgpu_core::command::clear::clear_texture_via_buffer_copies (cognitive 16) wgpu-core/src/command/clear.rs:400 — wgpu_core::command::clear::clear_texture_via_buffer_copies has cognitive complexity 16 (threshold 15). Drivers by points: loops 4 (10 pts), if/else 4 (5 pts), boolean chains 1 (nesting depth added 7). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D30 · Dependency Vulnerabilities · Medium advisory (unmaintained) · ×9
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (18 lines × 2) · ×9
  • Duplicated block (18 lines × 2) deno_webgpu/compute_pass.rs:162 — deno_webgpu/compute_pass.rs:162-179 | deno_webgpu/render_pass.rs:218-235 — before extracting anything, compare `deno_webgpu/compute_pass.rs` and `deno_webgpu/render_pass.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 70 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (18 lines × 2) naga/src/back/hlsl/writer.rs:4230 — naga/src/back/hlsl/writer.rs:4230-4247 | naga/src/back/wgsl/writer.rs:1647-1664 — `naga/src/back/hlsl/writer.rs` and `naga/src/back/wgsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 18 separate duplicated blocks between them, totalling at least 185 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (18 lines × 2) naga/src/back/wgsl/writer.rs:396 — naga/src/back/wgsl/writer.rs:396-413 | naga/src/back/wgsl/writer.rs:415-432 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18 lines × 2) naga/src/front/wgsl/lower/construction.rs:387 — naga/src/front/wgsl/lower/construction.rs:387-404 | naga/src/front/wgsl/lower/construction.rs:424-441 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18 lines × 2) naga/src/valid/function.rs:1634 — naga/src/valid/function.rs:1634-1651 | naga/src/valid/function.rs:1655-1672 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18 lines × 2) naga/src/front/spv/next_block.rs:872 — naga/src/front/spv/next_block.rs:872-889 | naga/src/front/spv/next_block.rs:976-993 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18 lines × 2) naga/src/front/spv/next_block.rs:2450 — naga/src/front/spv/next_block.rs:2450-2467 | naga/src/front/spv/next_block.rs:2495-2512 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18 lines × 2) wgpu-core/src/command/mod.rs:222 — wgpu-core/src/command/mod.rs:222-239 | wgpu-core/src/command/mod.rs:266-283 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18 lines × 2) wgpu-core/src/device/resource.rs:4583 — wgpu-core/src/device/resource.rs:4583-4600 | wgpu-core/src/device/resource.rs:5550-5567 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D2 · Cognitive Complexity · Lowerer · ×8
  • Lowerer::call_builtin (cognitive 90) naga/src/front/wgsl/lower/mod.rs:3094 — Lowerer::call_builtin has cognitive complexity 90 (threshold 15). Drivers by points: if/else 26 (51 pts), match/switch 10 (32 pts), loops 2 (6 pts), boolean chains 1 (nesting depth added 51). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Lowerer::statement (cognitive 86) naga/src/front/wgsl/lower/mod.rs:1794 — Lowerer::statement has cognitive complexity 86 (threshold 15). Drivers by points: match/switch 20 (46 pts), if/else 16 (37 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 48). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Lowerer::expression_for_reference (cognitive 56) naga/src/front/wgsl/lower/mod.rs:2391 — 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:1560 — 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:4776 — 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:1273 — 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:4275 — 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:2818 — Lowerer::finalize_type has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (14 pts), match/switch 2 (3 pts) (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D1 · Cyclomatic Complexity · Lowerer · ×7
  • Lowerer::call_builtin (cyclomatic 74) naga/src/front/wgsl/lower/mod.rs:3094 — Lowerer::call_builtin has cyclomatic complexity 74 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Lowerer::statement (cyclomatic 51) naga/src/front/wgsl/lower/mod.rs:1794 — Lowerer::statement has cyclomatic complexity 51 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Lowerer::expression_for_reference (cyclomatic 42) naga/src/front/wgsl/lower/mod.rs:2391 — 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:1273 — 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:1560 — Lowerer::function has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Lowerer::finalize_type (cyclomatic 19) naga/src/front/wgsl/lower/mod.rs:2818 — Lowerer::finalize_type has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D17 · Explicit Debt · FixmeComment · ×7
  • FixmeComment 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.
  • 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 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.
D2 · Cognitive Complexity · BlockContext · ×7
  • BlockContext::cache_expression_value (cognitive 183) naga/src/back/spv/block.rs:790 — BlockContext::cache_expression_value has cognitive complexity 183 (threshold 15). Drivers by points: match/switch 49 (122 pts), if/else 29 (58 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 103). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • BlockContext::write_block (cognitive 135) naga/src/back/spv/block.rs:3533 — BlockContext::write_block has cognitive complexity 135 (threshold 15). Drivers by points: match/switch 22 (59 pts), if/else 20 (57 pts), loops 6 (16 pts), boolean chains 3 (nesting depth added 84). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • BlockContext::write_checked_load (cognitive 25) naga/src/back/spv/block.rs:2856 — BlockContext::write_checked_load has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 5 (12 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • BlockContext::write_access_chain (cognitive 23) naga/src/back/spv/block.rs:2571 — BlockContext::write_access_chain has cognitive complexity 23 (threshold 15). Drivers by points: match/switch 6 (14 pts), if/else 5 (8 pts), loops 1 (nesting depth added 11). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • BlockContext::write_as_expression (cognitive 22) naga/src/back/spv/block.rs:2293 — BlockContext::write_as_expression has cognitive complexity 22 (threshold 15). Drivers by points: match/switch 8 (12 pts), if/else 4 (7 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • BlockContext::write_image_query (cognitive 22) naga/src/back/spv/image.rs:1116 — BlockContext::write_image_query has cognitive complexity 22 (threshold 15). Drivers by points: match/switch 9 (17 pts), if/else 3 (5 pts) (nesting depth added 10). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • BlockContext::write_image_sample (cognitive 21) naga/src/back/spv/image.rs:803 — BlockContext::write_image_sample has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (15 pts), match/switch 3 (5 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication · Duplicated block (14 lines × 2) · ×7
  • Duplicated block (14 lines × 2) deno_webgpu/device.rs:476 — deno_webgpu/device.rs:476-489 | deno_webgpu/device.rs:516-529 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) naga/src/back/spv/block.rs:3267 — naga/src/back/spv/block.rs:3267-3280 | naga/src/back/spv/block.rs:3367-3380 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) naga/src/back/spv/ray/mod.rs:68 — naga/src/back/spv/ray/mod.rs:68-81 | naga/src/back/spv/ray/mod.rs:102-115 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) naga/src/common/wgsl/types.rs:275 — naga/src/common/wgsl/types.rs:275-288 | naga/src/common/wgsl/types.rs:292-305 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) naga/src/front/wgsl/lower/construction.rs:194 — naga/src/front/wgsl/lower/construction.rs:194-207 | naga/src/front/wgsl/lower/construction.rs:216-229 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) wgpu-core/src/command/transfer.rs:1243 — wgpu-core/src/command/transfer.rs:1243-1256 | wgpu-core/src/command/transfer.rs:1360-1373 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) naga/src/valid/type.rs:324 — naga/src/valid/type.rs:324-337 | naga/src/valid/type.rs:348-361 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D1 · Cyclomatic Complexity · BlockContext · ×6
  • BlockContext::cache_expression_value (cyclomatic 249) naga/src/back/spv/block.rs:790 — BlockContext::cache_expression_value has cyclomatic complexity 249 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • BlockContext::write_block (cyclomatic 83) naga/src/back/spv/block.rs:3533 — BlockContext::write_block has cyclomatic complexity 83 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • BlockContext::write_as_expression (cyclomatic 32) naga/src/back/spv/block.rs:2293 — BlockContext::write_as_expression has cyclomatic complexity 32 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • BlockContext::write_access_chain (cyclomatic 18) naga/src/back/spv/block.rs:2571 — BlockContext::write_access_chain has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • BlockContext::write_image_sample (cyclomatic 18) naga/src/back/spv/image.rs:803 — BlockContext::write_image_sample has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • BlockContext::write_image_query (cyclomatic 18) naga/src/back/spv/image.rs:1116 — BlockContext::write_image_query has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D2 · Cognitive Complexity · ParsingContext · ×6
  • ParsingContext::parse_statement (cognitive 74) naga/src/front/glsl/parser/functions.rs:41 — ParsingContext::parse_statement has cognitive complexity 74 (threshold 15). Drivers by points: if/else 21 (45 pts), match/switch 7 (21 pts), loops 2 (5 pts), boolean chains 3 (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ParsingContext::parse_declaration (cognitive 49) naga/src/front/glsl/parser/declarations.rs:294 — ParsingContext::parse_declaration has cognitive complexity 49 (threshold 15). Drivers by points: if/else 12 (25 pts), match/switch 7 (23 pts), boolean chains 1 (nesting depth added 29). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • ParsingContext::parse_type_qualifiers (cognitive 26) naga/src/front/glsl/parser/types.rs:169 — ParsingContext::parse_type_qualifiers has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (20 pts), match/switch 2 (5 pts), loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ParsingContext::parse_postfix (cognitive 23) naga/src/front/glsl/parser/expressions.rs:125 — ParsingContext::parse_postfix has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (11 pts), match/switch 4 (11 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ParsingContext::parse_init_declarator_list (cognitive 21) naga/src/front/glsl/parser/declarations.rs:167 — ParsingContext::parse_init_declarator_list has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (14 pts), match/switch 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ParsingContext::parse_layout_qualifier_id (cognitive 17) naga/src/front/glsl/parser/types.rs:325 — ParsingContext::parse_layout_qualifier_id has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), match/switch 3 (8 pts) (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D4 · Code Duplication · Duplicated block (12 lines × 3) · ×6
  • Duplicated block (12 lines × 3) deno_webgpu/compute_pass.rs:168 — deno_webgpu/compute_pass.rs:168-179 | deno_webgpu/render_bundle.rs:162-173 | deno_webgpu/render_pass.rs:224-235 — before extracting anything, compare `deno_webgpu/compute_pass.rs` and `deno_webgpu/render_pass.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 70 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 3) naga/src/back/spv/mesh_shader.rs:85 — naga/src/back/spv/mesh_shader.rs:85-96 | naga/src/back/spv/mesh_shader.rs:108-119 | naga/src/back/spv/mesh_shader.rs:121-132 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (12 lines × 3) naga/src/front/glsl/builtins.rs:349 — naga/src/front/glsl/builtins.rs:349-360 | naga/src/front/glsl/builtins.rs:373-384 | naga/src/front/glsl/builtins.rs:412-423 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (12 lines × 3) naga/src/valid/interface.rs:479 — naga/src/valid/interface.rs:479-490 | naga/src/valid/interface.rs:492-503 | naga/src/valid/interface.rs:631-642 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (12 lines × 3) naga/src/back/msl/ray.rs:419 — naga/src/back/msl/ray.rs:419-430 | naga/src/back/msl/ray.rs:473-484 | naga/src/back/msl/ray.rs:503-514 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (12 lines × 3) naga/src/front/wgsl/lower/mod.rs:3608 — naga/src/front/wgsl/lower/mod.rs:3608-3619 | naga/src/front/wgsl/lower/mod.rs:3621-3632 | naga/src/front/wgsl/lower/mod.rs:3634-3645 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (6 lines × 3) · ×6
  • Duplicated block (6 lines × 3) naga/src/back/hlsl/writer.rs:2734 — naga/src/back/hlsl/writer.rs:2734-2739 | naga/src/back/hlsl/writer.rs:2943-2948 | naga/src/back/hlsl/writer.rs:3007-3012 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (6 lines × 3) naga/src/front/spv/mod.rs:1007 — naga/src/front/spv/mod.rs:1007-1012 | naga/src/front/spv/mod.rs:1037-1042 | naga/src/front/spv/mod.rs:1317-1322 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (6 lines × 3) wgpu-core/src/binding_model.rs:1286 — wgpu-core/src/binding_model.rs:1286-1291 | wgpu-core/src/binding_model.rs:1775-1780 | wgpu-core/src/pipeline.rs:114-119 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (6 lines × 3) wgpu-core/src/binding_model.rs:1293 — wgpu-core/src/binding_model.rs:1293-1298 | wgpu-core/src/pipeline.rs:558-563 | wgpu-core/src/pipeline.rs:1225-1230 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (6 lines × 3) naga/src/back/msl/writer.rs:5084 — naga/src/back/msl/writer.rs:5084-5089 | naga/src/back/msl/writer.rs:5266-5276 | naga/src/back/msl/writer.rs:5652-5662 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (6 lines × 3) wgpu-hal/src/auxil/dxgi/dxgi_lib.rs:50 — wgpu-hal/src/auxil/dxgi/dxgi_lib.rs:50-55 | wgpu-hal/src/auxil/dxgi/dxgi_lib.rs:74-81 | wgpu-hal/src/auxil/dxgi/dxgi_lib.rs:98-103 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (5 lines × 3) · ×6
  • Duplicated block (5 lines × 3) naga/src/back/hlsl/help.rs:1056 — naga/src/back/hlsl/help.rs:1056-1060 | naga/src/back/hlsl/help.rs:1117-1121 | naga/src/back/hlsl/help.rs:1196-1200 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (5 lines × 3) naga/src/back/hlsl/storage.rs:357 — naga/src/back/hlsl/storage.rs:357-361 | naga/src/back/hlsl/storage.rs:377-381 | naga/src/back/hlsl/storage.rs:428-433 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (5 lines × 3) naga/src/front/wgsl/parse/mod.rs:1898 — naga/src/front/wgsl/parse/mod.rs:1898-1902 | naga/src/front/wgsl/parse/mod.rs:1904-1908 | naga/src/front/wgsl/parse/mod.rs:1910-1914 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (5 lines × 3) wgpu-hal/src/gles/queue.rs:70 — wgpu-hal/src/gles/queue.rs:70-74 | wgpu-hal/src/gles/queue.rs:91-95 | wgpu-hal/src/gles/web.rs:289-293 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (5 lines × 3) naga/src/back/hlsl/writer.rs:3821 — naga/src/back/hlsl/writer.rs:3821-3838 | naga/src/back/hlsl/writer.rs:3848-3854 | naga/src/back/hlsl/writer.rs:3864-3868 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (5 lines × 3) naga/src/back/msl/writer.rs:2411 — naga/src/back/msl/writer.rs:2411-2415 | naga/src/back/msl/writer.rs:2420-2424 | naga/src/back/msl/writer.rs:2430-2434 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D1 · Cyclomatic Complexity · Adapter · ×5
  • Adapter::expose (cyclomatic 103) wgpu-hal/src/dx12/adapter.rs:65 — Adapter::expose has cyclomatic complexity 103 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • Adapter::expose (cyclomatic 96) wgpu-hal/src/gles/adapter.rs:195 — Adapter::expose has cyclomatic complexity 96 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • Adapter::texture_format_capabilities (cyclomatic 55) wgpu-hal/src/gles/adapter.rs:1149 — Adapter::texture_format_capabilities has cyclomatic complexity 55 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Adapter::texture_format_capabilities (cyclomatic 50) wgpu-hal/src/metal/adapter.rs:176 — Adapter::texture_format_capabilities has cyclomatic complexity 50 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Adapter::device_from_raw (cyclomatic 47) wgpu-hal/src/vulkan/adapter.rs:2667 — Adapter::device_from_raw has cyclomatic complexity 47 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ConstantEvaluator · ×5
  • ConstantEvaluator::binary_op (cognitive 147) naga/src/proc/constant_evaluator.rs:2858 — ConstantEvaluator::binary_op has cognitive complexity 147 (threshold 15). Drivers by points: if/else 27 (85 pts), match/switch 16 (52 pts), boolean chains 6, loops 2 (4 pts) (nesting depth added 96). Of this number, 144 points are the body's own statements and 3 belong to one function item inside it that branches. The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • ConstantEvaluator::math (cognitive 60) naga/src/proc/constant_evaluator.rs:1489 — ConstantEvaluator::math has cognitive complexity 60 (threshold 15). Drivers by points: if/else 21 (40 pts), match/switch 9 (16 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 27). Of this number, 41 points are the body's own statements and 19 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ConstantEvaluator::cast (cognitive 35) naga/src/proc/constant_evaluator.rs:2486 — ConstantEvaluator::cast has cognitive complexity 35 (threshold 15). Drivers by points: match/switch 15 (33 pts), loops 1 (2 pts) (nesting depth added 19). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • ConstantEvaluator::select (cognitive 23) naga/src/proc/constant_evaluator.rs:3700 — ConstantEvaluator::select has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (15 pts), match/switch 4 (8 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ConstantEvaluator::unary_op (cognitive 16) naga/src/proc/constant_evaluator.rs:2800 — ConstantEvaluator::unary_op has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 6 (14 pts), loops 1 (2 pts) (nesting depth added 9). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D4 · Code Duplication · Duplicated block (22 lines × 2) · ×5
  • Duplicated block (22 lines × 2) naga/src/back/glsl/writer.rs:2236 — naga/src/back/glsl/writer.rs:2236-2257 | naga/src/back/wgsl/writer.rs:1168-1189 — `naga/src/back/glsl/writer.rs` and `naga/src/back/wgsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 135 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (22 lines × 2) naga/src/front/spv/mod.rs:2443 — naga/src/front/spv/mod.rs:2443-2464 | naga/src/front/spv/mod.rs:2494-2515 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (22 lines × 2) wgpu-core/src/command/compute.rs:1183 — wgpu-core/src/command/compute.rs:1183-1204 | wgpu-core/src/command/render.rs:3637-3658 — before extracting anything, compare `wgpu-core/src/command/compute.rs` and `wgpu-core/src/command/render.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 65 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (22 lines × 2) wgpu-core/src/indirect_validation/dispatch.rs:315 — wgpu-core/src/indirect_validation/dispatch.rs:315-336 | 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 7 separate duplicated blocks between them, totalling at least 92 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (22 lines × 2) wgpu-hal/src/dx12/suballocation.rs:461 — wgpu-hal/src/dx12/suballocation.rs:461-482 | wgpu-hal/src/dx12/suballocation.rs:504-525 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (21 lines × 2) · ×5
  • Duplicated block (21 lines × 2) naga/src/back/msl/writer.rs:5918 — naga/src/back/msl/writer.rs:5918-5938 | naga/src/back/msl/writer.rs:6192-6212 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (21 lines × 2) naga/src/front/glsl/functions.rs:1037 — naga/src/front/glsl/functions.rs:1037-1057 | naga/src/front/glsl/functions.rs:1126-1146 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (21 lines × 2) wgpu-core/src/command/bundle.rs:1239 — wgpu-core/src/command/bundle.rs:1239-1259 | wgpu-core/src/command/render.rs:3176-3196 — 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/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.
  • Duplicated block (21 lines × 2) wgpu-hal/src/dx12/command.rs:1543 — wgpu-hal/src/dx12/command.rs:1543-1563 | wgpu-hal/src/dx12/command.rs:1582-1602 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D1 · Cyclomatic Complexity · ConstantEvaluator · ×4
  • ConstantEvaluator::cast (cyclomatic 119) naga/src/proc/constant_evaluator.rs:2486 — ConstantEvaluator::cast has cyclomatic complexity 119 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ConstantEvaluator::binary_op (cyclomatic 119) naga/src/proc/constant_evaluator.rs:2858 — ConstantEvaluator::binary_op has cyclomatic complexity 119 (threshold 15). Of this number, 116 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ConstantEvaluator::math (cyclomatic 93) naga/src/proc/constant_evaluator.rs:1489 — ConstantEvaluator::math has cyclomatic complexity 93 (threshold 15). Of this number, 86 points are the body's own statements and 7 belong to 4 function items inside it that branch. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ConstantEvaluator::unary_op (cyclomatic 23) naga/src/proc/constant_evaluator.rs:2800 — ConstantEvaluator::unary_op has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: ConstantEvaluator::try_eval_and_append_impl (cyclomatic 30) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D2 · Cognitive Complexity · Queue · ×4
  • Queue::process (cognitive 213) wgpu-hal/src/gles/queue.rs:192 — Queue::process has cognitive complexity 213 (threshold 15). Drivers by points: if/else 85 (155 pts), match/switch 14 (27 pts), loops 8 (22 pts), boolean chains 9 (nesting depth added 97). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Queue::submit_inner (cognitive 54) wgpu-core/src/device/queue.rs:1511 — 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:1233 — 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:966 — Queue::write_texture_inner has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (13 pts), loops 3 (7 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · Adapter · ×4
  • Adapter::expose (cognitive 137) wgpu-hal/src/gles/adapter.rs:195 — Adapter::expose has cognitive complexity 137 (threshold 15). Drivers by points: if/else 78 (91 pts), boolean chains 45, match/switch 1 (nesting depth added 13). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • Adapter::expose (cognitive 106) wgpu-hal/src/dx12/adapter.rs:65 — Adapter::expose has cognitive complexity 106 (threshold 15). Drivers by points: if/else 59 (68 pts), boolean chains 20, match/switch 11 (17 pts), loops 1 (nesting depth added 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • Adapter::device_from_raw (cognitive 56) wgpu-hal/src/vulkan/adapter.rs:2667 — Adapter::device_from_raw has cognitive complexity 56 (threshold 15). Drivers by points: if/else 51, boolean chains 4, match/switch 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • Adapter::texture_format_capabilities (cognitive 47) wgpu-hal/src/metal/adapter.rs:176 — Adapter::texture_format_capabilities has cognitive complexity 47 (threshold 15). Drivers by points: if/else 30 (44 pts), match/switch 2, boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Instance · ×4
  • Instance::init_with_callback (cognitive 35) wgpu-hal/src/vulkan/instance.rs:765 — Instance::init_with_callback has cognitive complexity 35 (threshold 15). Drivers by points: if/else 22 (28 pts), boolean chains 4, match/switch 2 (3 pts) (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • Instance::request_adapter (cognitive 31) wgpu-core/src/instance.rs:481 — Instance::request_adapter has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (26 pts), loops 2 (3 pts), match/switch 2 (nesting depth added 13). Of this number, 30 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Instance::enumerate_adapters (cognitive 24) wgpu-hal/src/vulkan/instance.rs:1156 — Instance::enumerate_adapters has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (18 pts), boolean chains 3, loops 1 (2 pts), match/switch 1 (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • Instance::expose_adapter (cognitive 23) wgpu-hal/src/vulkan/adapter.rs:2299 — Instance::expose_adapter has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 9, match/switch 2 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · wgpu_hal · ×4
  • wgpu_hal::gles::egl::choose_config (cognitive 23) wgpu-hal/src/gles/egl.rs:93 — wgpu_hal::gles::egl::choose_config has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 3 (6 pts), match/switch 2 (4 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • wgpu_hal::vulkan::instance::debug_utils_messenger_callback (cognitive 22) wgpu-hal/src/vulkan/instance.rs:18 — wgpu_hal::vulkan::instance::debug_utils_messenger_callback has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 4, match/switch 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
  • wgpu_hal::auxil::dxgi::hdr::output_desc1_from_factory (cognitive 21) wgpu-hal/src/auxil/dxgi/hdr.rs:188 — wgpu_hal::auxil::dxgi::hdr::output_desc1_from_factory has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 5 (14 pts), if/else 2 (4 pts), loops 2 (3 pts) (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • wgpu_hal::dx12::adapter::get_adapter_pci_info (cognitive 17) wgpu-hal/src/dx12/adapter.rs:1410 — wgpu_hal::dx12::adapter::get_adapter_pci_info has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 1, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D3 · God Classes · TooManyFields · ×4
  • TooManyFields: CapabilitiesQuery wgpu-hal/src/metal/mod.rs:228 — TooManyFields — 107 stored fields beside 7 methods. The bar is 30 stored fields; this is 77 over it, 3.57× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: Limits wgpu-types/src/limits.rs:144 — 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:921 — TooManyFields — 39 stored fields beside 97 methods. The bar is 30 stored fields; this is 9 over it, 1.30× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: Device wgpu-core/src/device/resource.rs:232 — TooManyFields — 31 stored fields beside 101 methods. The bar is 30 stored fields; this is 1 over it, 1.03× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
D4 · Code Duplication · Duplicated block (20 lines × 2) · ×4
  • Duplicated block (20 lines × 2) naga/src/back/hlsl/help.rs:1617 — naga/src/back/hlsl/help.rs:1617-1636 | naga/src/back/hlsl/help.rs:1682-1701 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (20 lines × 2) wgpu-core/src/command/bundle.rs:463 — wgpu-core/src/command/bundle.rs:463-482 | wgpu-core/src/command/render.rs:2464-2483 — before extracting anything, compare `wgpu-core/src/command/bundle.rs` and `wgpu-core/src/command/render.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 83 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (20 lines × 2) wgpu-core/src/command/ray_tracing.rs:610 — wgpu-core/src/command/ray_tracing.rs:610-629 | wgpu-core/src/command/ray_tracing.rs:955-974 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (20 lines × 2) wgpu-hal/src/gles/egl.rs:1171 — wgpu-hal/src/gles/egl.rs:1171-1190 | wgpu-hal/src/gles/wgl.rs:718-737 — before extracting anything, compare `wgpu-hal/src/gles/egl.rs` and `wgpu-hal/src/gles/wgl.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 73 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (17–18 lines × 2) · ×4
  • Duplicated block (17–18 lines × 2) naga/src/back/glsl/conv.rs:140 — naga/src/back/glsl/conv.rs:140-156 | naga/src/back/msl/mod.rs:693-710 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (17–18 lines × 2) wgpu-core/src/command/memory_init.rs:397 — wgpu-core/src/command/memory_init.rs:397-414 | wgpu-core/src/command/memory_init.rs:475-491 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (17–18 lines × 2) wgpu-core/src/command/ray_tracing.rs:709 — wgpu-core/src/command/ray_tracing.rs:709-725 | wgpu-core/src/command/ray_tracing.rs:998-1015 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (17–18 lines × 2) wgpu-core/src/track/texture.rs:1282 — wgpu-core/src/track/texture.rs:1282-1299 | wgpu-core/src/track/texture.rs:1318-1334 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (9 lines × 3) · ×4
  • Duplicated block (9 lines × 3) deno_webgpu/webidl.rs:46 — deno_webgpu/webidl.rs:46-54 | deno_webgpu/webidl.rs:156-164 | deno_webgpu/webidl.rs:251-259 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (9 lines × 3) naga/src/back/glsl/writer.rs:2273 — naga/src/back/glsl/writer.rs:2273-2281 | naga/src/back/msl/writer.rs:4421-4429 | naga/src/back/wgsl/writer.rs:1205-1213 — `naga/src/back/glsl/writer.rs` and `naga/src/back/msl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 66 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (9 lines × 3) naga/src/front/glsl/parser.rs:270 — naga/src/front/glsl/parser.rs:270-278 | naga/src/front/glsl/parser.rs:293-301 | naga/src/front/glsl/parser.rs:377-385 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (9 lines × 3) wgpu-hal/src/gles/queue.rs:1821 — wgpu-hal/src/gles/queue.rs:1821-1829 | wgpu-hal/src/gles/queue.rs:1855-1863 | wgpu-hal/src/gles/queue.rs:1890-1898 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
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:1511 — 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:1233 — 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::to_wgpu (cyclomatic 40) wgpu-hal/src/vulkan/adapter.rs:665 — PhysicalDeviceFeatures::to_wgpu has cyclomatic complexity 40 (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::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::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::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::expose_adapter (cyclomatic 24) wgpu-hal/src/vulkan/adapter.rs:2299 — Instance::expose_adapter has cyclomatic complexity 24 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • Instance::request_adapter (cyclomatic 21) wgpu-core/src/instance.rs:481 — Instance::request_adapter has cyclomatic complexity 21 (threshold 15). Of this number, 15 points are the body's own statements and 6 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D2 · Cognitive Complexity · PhysicalDeviceFeatures · ×3
  • PhysicalDeviceFeatures::from_extensions_and_requested_features (cognitive 64) wgpu-hal/src/vulkan/adapter.rs:276 — PhysicalDeviceFeatures::from_extensions_and_requested_features has cognitive complexity 64 (threshold 15). Drivers by points: if/else 52, boolean chains 11, match/switch 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • PhysicalDeviceFeatures::to_wgpu (cognitive 40) wgpu-hal/src/vulkan/adapter.rs:665 — PhysicalDeviceFeatures::to_wgpu has cognitive complexity 40 (threshold 15). Drivers by points: boolean chains 23, if/else 16 (17 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
  • PhysicalDeviceFeatures::add_to_device_create (cognitive 26) wgpu-hal/src/vulkan/adapter.rs:157 — PhysicalDeviceFeatures::add_to_device_create has cognitive complexity 26 (threshold 15). Drivers by points: if/else 26. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · FunctionInfo · ×3
  • FunctionInfo::process_block (cognitive 62) naga/src/valid/analyzer.rs:879 — FunctionInfo::process_block has cognitive complexity 62 (threshold 15). Drivers by points: if/else 13 (37 pts), loops 5 (13 pts), match/switch 4 (11 pts), boolean chains 1 (nesting depth added 39). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FunctionInfo::process_expression (cognitive 42) naga/src/valid/analyzer.rs:531 — FunctionInfo::process_expression has cognitive complexity 42 (threshold 15). Drivers by points: match/switch 10 (25 pts), if/else 9 (16 pts), boolean chains 1 (nesting depth added 22). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • FunctionInfo::process_call (cognitive 16) naga/src/valid/analyzer.rs:439 — FunctionInfo::process_call has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), match/switch 3 (6 pts), loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Parser · ×3
  • Parser::statement (cognitive 47) naga/src/front/wgsl/parse/mod.rs:1255 — Parser::statement has cognitive complexity 47 (threshold 15). Drivers by points: if/else 12 (31 pts), loops 4 (10 pts), match/switch 3 (5 pts), boolean chains 1 (nesting depth added 27). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Parser::global_decl (cognitive 46) naga/src/front/wgsl/parse/mod.rs:1839 — Parser::global_decl has cognitive complexity 46 (threshold 15). Drivers by points: if/else 16 (29 pts), match/switch 6 (12 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Parser::parse (cognitive 25) naga/src/front/wgsl/parse/mod.rs:2242 — Parser::parse has cognitive complexity 25 (threshold 15). Drivers by points: match/switch 4 (13 pts), if/else 4 (10 pts), loops 2 (nesting depth added 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D4 · Code Duplication · Duplicated block (23 lines × 2) · ×3
  • Duplicated block (23 lines × 2) naga/src/back/hlsl/writer.rs:5018 — naga/src/back/hlsl/writer.rs:5018-5040 | naga/src/back/hlsl/writer.rs:5076-5098 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (23 lines × 2) naga/src/front/glsl/builtins.rs:1015 — naga/src/front/glsl/builtins.rs:1015-1037 | naga/src/front/glsl/builtins.rs:1165-1187 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (23 lines × 2) wgpu-core/src/device/queue.rs:1048 — wgpu-core/src/device/queue.rs:1048-1070 | wgpu-core/src/device/queue.rs:1340-1362 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (17 lines × 2) · ×3
  • Duplicated block (17 lines × 2) naga/src/back/spv/writer.rs:2793 — naga/src/back/spv/writer.rs:2793-2809 | naga/src/back/spv/writer.rs:2825-2841 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (17 lines × 2) naga/src/front/glsl/functions.rs:1238 — naga/src/front/glsl/functions.rs:1238-1254 | naga/src/front/glsl/functions.rs:1291-1307 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (17 lines × 2) naga/src/valid/interface.rs:595 — naga/src/valid/interface.rs:595-611 | naga/src/valid/interface.rs:613-629 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (15–16 lines × 2) · ×3
  • Duplicated block (15–16 lines × 2) naga/src/front/spv/next_block.rs:501 — naga/src/front/spv/next_block.rs:501-515 | naga/src/front/spv/next_block.rs:568-583 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15–16 lines × 2) wgpu-core/src/device/resource.rs:2612 — wgpu-core/src/device/resource.rs:2612-2626 | wgpu-core/src/device/resource.rs:2771-2786 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15–16 lines × 2) wgpu-core/src/track/texture.rs:579 — wgpu-core/src/track/texture.rs:579-594 | wgpu-core/src/track/texture.rs:620-634 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (10 lines × 3) · ×3
  • Duplicated block (10 lines × 3) naga/src/back/hlsl/writer.rs:3394 — naga/src/back/hlsl/writer.rs:3394-3403 | naga/src/back/hlsl/writer.rs:3426-3435 | naga/src/back/hlsl/writer.rs:3439-3448 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (10 lines × 3) naga/src/back/glsl/mod.rs:102 — naga/src/back/glsl/mod.rs:102-111 | naga/src/back/hlsl/mod.rs:234-243 | naga/src/back/msl/mod.rs:135-144 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (10 lines × 3) naga/src/back/msl/writer.rs:5097 — naga/src/back/msl/writer.rs:5097-5106 | naga/src/back/msl/writer.rs:5288-5300 | naga/src/back/msl/writer.rs:5709-5721 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D1 · Cyclomatic Complexity · Interface · ×2
  • Interface::check_stage (cyclomatic 85) wgpu-core/src/validation.rs:1563 — Interface::check_stage has cyclomatic complexity 85 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Interface::new (cyclomatic 18) wgpu-core/src/validation.rs:1362 — Interface::new has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions. This is NOT this file's highest cyclomatic complexity: Interface::populate (cyclomatic 59) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · FeaturesManager · ×2
  • FeaturesManager::check_availability (cyclomatic 69) naga/src/back/glsl/features.rs:96 — FeaturesManager::check_availability has cyclomatic complexity 69 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
  • FeaturesManager::write (cyclomatic 42) naga/src/back/glsl/features.rs:163 — FeaturesManager::write has cyclomatic complexity 42 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · FunctionInfo · ×2
  • FunctionInfo::process_expression (cyclomatic 51) naga/src/valid/analyzer.rs:531 — FunctionInfo::process_expression has cyclomatic complexity 51 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • FunctionInfo::process_block (cyclomatic 45) naga/src/valid/analyzer.rs:879 — FunctionInfo::process_block has cyclomatic complexity 45 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · Resource · ×2
  • Resource::check_binding_use (cyclomatic 35) wgpu-core/src/validation.rs:680 — 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:882 — Resource::derive_binding_type has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: Interface::populate (cyclomatic 59) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · Surface · ×2
  • Surface::configure (cyclomatic 19) wgpu-hal/src/metal/surface.rs:248 — 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-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.
  • XxxComment wgpu-types/src/counters.rs:185 — // XXX: Rename to total_capacity_bytes following the rename at https://github.com/Traverse-Research/gpu-allocator/pull/266?
D2 · Cognitive Complexity · Interface · ×2
  • Interface::check_stage (cognitive 151) wgpu-core/src/validation.rs:1563 — Interface::check_stage has cognitive complexity 151 (threshold 15). Drivers by points: if/else 44 (92 pts), match/switch 15 (36 pts), loops 9 (16 pts), boolean chains 7 (nesting depth added 76). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Interface::new (cognitive 27) wgpu-core/src/validation.rs:1362 — Interface::new has cognitive complexity 27 (threshold 15). Drivers by points: if/else 4 (9 pts), match/switch 4 (9 pts), loops 5 (8 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · VaryingContext · ×2
  • VaryingContext::validate_impl (cognitive 140) naga/src/valid/interface.rs:234 — VaryingContext::validate_impl has cognitive complexity 140 (threshold 15). Drivers by points: match/switch 29 (58 pts), if/else 26 (53 pts), boolean chains 29 (nesting depth added 56). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • VaryingContext::validate (cognitive 28) naga/src/valid/interface.rs:846 — VaryingContext::validate has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (19 pts), match/switch 2 (5 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · wgpu_xtask · ×2
  • wgpu_xtask::cts::run_cts (cognitive 74) xtask/src/cts.rs:66 — wgpu_xtask::cts::run_cts has cognitive complexity 74 (threshold 15). Drivers by points: if/else 41 (59 pts), boolean chains 8, match/switch 2 (4 pts), loops 3 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • wgpu_xtask::vendor_web_sys::run_vendor_web_sys (cognitive 18) xtask/src/vendor_web_sys.rs:156 — wgpu_xtask::vendor_web_sys::run_vendor_web_sys has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (15 pts), loops 2, match/switch 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FeaturesManager · ×2
  • FeaturesManager::check_availability (cognitive 69) naga/src/back/glsl/features.rs:96 — FeaturesManager::check_availability has cognitive complexity 69 (threshold 15). Drivers by points: boolean chains 44, if/else 24, match/switch 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
  • FeaturesManager::write (cognitive 49) naga/src/back/glsl/features.rs:163 — FeaturesManager::write has cognitive complexity 49 (threshold 15). Drivers by points: if/else 29 (36 pts), boolean chains 11, match/switch 1 (2 pts) (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Module · ×2
  • Module::analyze_mesh_shader_info (cognitive 65) naga/src/proc/mod.rs:757 — Module::analyze_mesh_shader_info has cognitive complexity 65 (threshold 15). Drivers by points: if/else 9 (32 pts), match/switch 6 (25 pts), loops 2 (8 pts) (nesting depth added 48). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Module::uses_mesh_shaders (cognitive 19) naga/src/proc/mod.rs:920 — Module::uses_mesh_shaders has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (10 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:680 — 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:882 — Resource::derive_binding_type has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 6 (13 pts), if/else 2 (3 pts) (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Namer · ×2
  • Namer::reset (cognitive 47) naga/src/proc/namer.rs:235 — Namer::reset has cognitive complexity 47 (threshold 15). Drivers by points: loops 14 (25 pts), if/else 5 (12 pts), match/switch 4 (10 pts) (nesting depth added 24). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • Namer::sanitize (cognitive 23) naga/src/proc/namer.rs:110 — Namer::sanitize has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 5, match/switch 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BakedCommands · ×2
  • BakedCommands::initialize_texture_memory (cognitive 23) wgpu-core/src/command/memory_init.rs:350 — BakedCommands::initialize_texture_memory has cognitive complexity 23 (threshold 15). Drivers by points: loops 6 (14 pts), if/else 4 (7 pts), match/switch 1 (2 pts) (nesting depth added 12). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • BakedCommands::initialize_buffer_memory (cognitive 17) wgpu-core/src/command/memory_init.rs:236 — BakedCommands::initialize_buffer_memory has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (6 pts), loops 4 (6 pts), match/switch 2 (5 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · wgpu_info · ×2
  • wgpu_info::human::print_adapter (cognitive 19) wgpu-info/src/human.rs:80 — wgpu_info::human::print_adapter has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 6 (8 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • wgpu_info::cli::main (cognitive 16) wgpu-info/src/cli.rs:31 — wgpu_info::cli::main has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (11 pts), loops 2 (3 pts), match/switch 2 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · Surface · ×2
  • Surface::configure (cognitive 17) wgpu-hal/src/dx12/mod.rs:1374 — Surface::configure has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), match/switch 5 (7 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Surface::configure (cognitive 16) wgpu-hal/src/metal/surface.rs:248 — 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:967 — naga/src/back/hlsl/help.rs:967-972 | naga/src/back/hlsl/help.rs:1031-1036 | naga/src/back/hlsl/help.rs:1091-1096 | naga/src/back/hlsl/help.rs:1169-1174 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) naga/src/front/spv/mod.rs:2134 — naga/src/front/spv/mod.rs:2134-2154 | naga/src/front/spv/mod.rs:2160-2189 | naga/src/front/spv/mod.rs:2195-2216 | naga/src/front/spv/mod.rs:2222-2252 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Duplicated block (42 lines × 2) · ×2
  • Duplicated block (42 lines × 2) naga/src/back/spv/mesh_shader.rs:209 — naga/src/back/spv/mesh_shader.rs:209-250 | naga/src/back/spv/mesh_shader.rs:289-330 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (42 lines × 2) wgpu-core/src/track/blas.rs:17 — wgpu-core/src/track/blas.rs:17-58 | wgpu-core/src/track/query_set.rs:17-62 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (29 lines × 2) · ×2
  • Duplicated block (29 lines × 2) naga/src/back/spv/block.rs:935 — naga/src/back/spv/block.rs:935-963 | naga/src/back/spv/block.rs:1026-1054 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (29 lines × 2) naga/src/front/glsl/builtins.rs:934 — naga/src/front/glsl/builtins.rs:934-962 | naga/src/front/glsl/builtins.rs:1091-1119 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (26 lines × 2) · ×2
  • Duplicated block (26 lines × 2) naga/src/front/spv/image.rs:861 — naga/src/front/spv/image.rs:861-886 | naga/src/front/spv/image.rs:906-931 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (26 lines × 2) wgpu-core/src/command/bundle.rs:1109 — wgpu-core/src/command/bundle.rs:1109-1134 | wgpu-core/src/command/render.rs:2922-2947 — before extracting anything, compare `wgpu-core/src/command/bundle.rs` and `wgpu-core/src/command/render.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 83 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (19–20 lines × 2) · ×2
  • Duplicated block (19–20 lines × 2) naga/src/back/spv/block.rs:862 — naga/src/back/spv/block.rs:862-880 | naga/src/back/spv/block.rs:989-1008 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (19–20 lines × 2) naga/src/front/glsl/context.rs:662 — naga/src/front/glsl/context.rs:662-681 | naga/src/front/glsl/context.rs:724-742 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (19 lines × 2) · ×2
  • Duplicated block (19 lines × 2) naga/src/back/hlsl/writer.rs:2255 — naga/src/back/hlsl/writer.rs:2255-2273 | naga/src/back/wgsl/writer.rs:802-820 — `naga/src/back/hlsl/writer.rs` and `naga/src/back/wgsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 18 separate duplicated blocks between them, totalling at least 185 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (19 lines × 2) wgpu-core/src/track/texture.rs:847 — wgpu-core/src/track/texture.rs:847-865 | wgpu-core/src/track/texture.rs:887-905 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (17 lines × 3) · ×2
  • Duplicated block (17 lines × 3) wgpu-hal/src/dx12/suballocation.rs:292 — wgpu-hal/src/dx12/suballocation.rs:292-308 | wgpu-hal/src/dx12/suballocation.rs:331-347 | wgpu-hal/src/dx12/suballocation.rs:370-386 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (17 lines × 3) wgpu-hal/src/gles/egl.rs:1478 — wgpu-hal/src/gles/egl.rs:1478-1494 | wgpu-hal/src/gles/web.rs:471-487 | wgpu-hal/src/gles/wgl.rs:884-900 — before extracting anything, compare `wgpu-hal/src/gles/egl.rs` and `wgpu-hal/src/gles/wgl.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 73 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (12–17 lines × 2) · ×2
  • Duplicated block (12–17 lines × 2) naga/src/back/glsl/writer.rs:3729 — naga/src/back/glsl/writer.rs:3729-3740 | naga/src/back/glsl/writer.rs:3742-3758 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12–17 lines × 2) wgpu-core/src/device/resource.rs:3491 — wgpu-core/src/device/resource.rs:3491-3507 | wgpu-core/src/device/resource.rs:3608-3619 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (12–15 lines × 2) · ×2
  • Duplicated block (12–15 lines × 2) naga/src/back/msl/writer.rs:3137 — naga/src/back/msl/writer.rs:3137-3151 | naga/src/back/msl/writer.rs:3156-3167 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12–15 lines × 2) naga/src/back/spv/block.rs:2914 — naga/src/back/spv/block.rs:2914-2925 | naga/src/back/spv/block.rs:3880-3894 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (14–15 lines × 2) · ×2
  • Duplicated block (14–15 lines × 2) naga/src/front/spv/next_block.rs:917 — naga/src/front/spv/next_block.rs:917-930 | naga/src/front/spv/next_block.rs:999-1013 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14–15 lines × 2) wgpu-hal/src/dx12/command.rs:228 — wgpu-hal/src/dx12/command.rs:228-242 | wgpu-hal/src/dx12/command.rs:254-267 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (13 lines × 3) · ×2
  • Duplicated block (13 lines × 3) naga/src/back/glsl/writer.rs:2487 — naga/src/back/glsl/writer.rs:2487-2499 | naga/src/back/hlsl/writer.rs:4106-4118 | naga/src/back/wgsl/writer.rs:1583-1595 — `naga/src/back/glsl/writer.rs` and `naga/src/back/hlsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 86 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (13 lines × 3) naga/src/back/msl/writer.rs:5137 — naga/src/back/msl/writer.rs:5137-5149 | naga/src/back/msl/writer.rs:5345-5357 | naga/src/back/msl/writer.rs:5807-5819 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (7–10 lines × 2) · ×2
  • Duplicated block (7–10 lines × 2) naga/src/back/spv/block.rs:3906 — naga/src/back/spv/block.rs:3906-3915 | naga/src/back/spv/block.rs:4262-4268 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7–10 lines × 2) wgpu-core/src/command/bundle.rs:1047 — wgpu-core/src/command/bundle.rs:1047-1053 | wgpu-core/src/command/render.rs:2831-2840 — before extracting anything, compare `wgpu-core/src/command/bundle.rs` and `wgpu-core/src/command/render.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 83 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (8–9 lines × 2) · ×2
  • Duplicated block (8–9 lines × 2) naga/src/back/wgsl/writer.rs:864 — naga/src/back/wgsl/writer.rs:864-871 | naga/src/back/wgsl/writer.rs:885-893 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8–9 lines × 2) naga/src/front/spv/next_block.rs:736 — naga/src/front/spv/next_block.rs:736-744 | naga/src/front/spv/next_block.rs:774-781 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (7–8 lines × 3) · ×2
  • Duplicated block (7–8 lines × 3) naga/src/back/glsl/writer.rs:2400 — naga/src/back/glsl/writer.rs:2400-2407 | naga/src/back/hlsl/writer.rs:3695-3701 | naga/src/back/wgsl/writer.rs:1471-1478 — `naga/src/back/glsl/writer.rs` and `naga/src/back/hlsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 86 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (7–8 lines × 3) naga/src/front/spv/mod.rs:1476 — naga/src/front/spv/mod.rs:1476-1483 | naga/src/front/spv/next_block.rs:2840-2846 | naga/src/front/spv/next_block.rs:2900-2906 — before extracting anything, compare `naga/src/front/spv/mod.rs` and `naga/src/front/spv/next_block.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (8 lines × 3) · ×2
  • Duplicated block (8 lines × 3) wgpu-hal/src/gles/egl.rs:1416 — wgpu-hal/src/gles/egl.rs:1416-1423 | wgpu-hal/src/gles/web.rs:415-423 | wgpu-hal/src/gles/wgl.rs:809-817 — before extracting anything, compare `wgpu-hal/src/gles/egl.rs` and `wgpu-hal/src/gles/wgl.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 73 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 3) wgpu-hal/src/metal/command.rs:329 — wgpu-hal/src/metal/command.rs:329-336 | wgpu-hal/src/metal/command.rs:400-407 | wgpu-hal/src/metal/command.rs:415-422 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (7–8 lines × 2) · ×2
  • Duplicated block (7–8 lines × 2) naga/src/front/spv/mod.rs:2766 — naga/src/front/spv/mod.rs:2766-2772 | naga/src/front/spv/mod.rs:2842-2849 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7–8 lines × 2) naga/src/front/wgsl/lower/mod.rs:3326 — naga/src/front/wgsl/lower/mod.rs:3326-3332 | naga/src/front/wgsl/lower/mod.rs:3534-3541 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (7 lines × 3) · ×2
  • Duplicated block (7 lines × 3) naga/src/front/wgsl/lower/mod.rs:3377 — naga/src/front/wgsl/lower/mod.rs:3377-3383 | naga/src/front/wgsl/lower/mod.rs:3513-3519 | naga/src/front/wgsl/lower/mod.rs:3552-3558 — 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:3722 — naga/src/front/wgsl/lower/mod.rs:3722-3728 | naga/src/front/wgsl/lower/mod.rs:3733-3739 | naga/src/front/wgsl/lower/mod.rs:3744-3750 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (6 lines × 5) · ×2
  • Duplicated block (6 lines × 5) naga/src/front/spv/mod.rs:1475 — naga/src/front/spv/mod.rs:1475-1480 | naga/src/front/spv/next_block.rs:861-869 | naga/src/front/spv/next_block.rs:2839-2844 | naga/src/front/spv/next_block.rs:2870-2875 | naga/src/front/spv/next_block.rs:2899-2904 — before extracting anything, compare `naga/src/front/spv/mod.rs` and `naga/src/front/spv/next_block.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 5) naga/src/front/spv/mod.rs:2161 — naga/src/front/spv/mod.rs:2161-2166 | naga/src/front/spv/mod.rs:2259-2264 | naga/src/front/spv/mod.rs:2314-2319 | naga/src/front/spv/mod.rs:2384-2389 | naga/src/front/spv/mod.rs:2628-2634 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (6 lines × 4) · ×2
  • Duplicated block (6 lines × 4) naga/src/back/msl/writer.rs:2274 — naga/src/back/msl/writer.rs:2274-2279 | naga/src/back/msl/writer.rs:2520-2525 | naga/src/back/msl/writer.rs:3105-3110 | naga/src/back/msl/writer.rs:4254-4259 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (6 lines × 4) naga/src/front/spv/mod.rs:1128 — naga/src/front/spv/mod.rs:1128-1133 | naga/src/front/spv/mod.rs:1203-1208 | naga/src/front/spv/mod.rs:1273-1279 | naga/src/front/spv/next_block.rs:865-870 — before extracting anything, compare `naga/src/front/spv/mod.rs` and `naga/src/front/spv/next_block.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (5 lines × 5) · ×2
  • Duplicated block (5 lines × 5) naga/src/back/hlsl/writer.rs:4167 — naga/src/back/hlsl/writer.rs:4167-4171 | naga/src/back/wgsl/writer.rs:1237-1241 | naga/src/back/wgsl/writer.rs:1623-1627 | naga/src/back/wgsl/writer.rs:1933-1937 | naga/src/back/wgsl/writer.rs:2011-2015 — `naga/src/back/hlsl/writer.rs` and `naga/src/back/wgsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 18 separate duplicated blocks between them, totalling at least 185 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (5 lines × 5) naga/src/front/spv/next_block.rs:462 — naga/src/front/spv/next_block.rs:462-467 | naga/src/front/spv/next_block.rs:1073-1077 | naga/src/front/spv/next_block.rs:1270-1274 | naga/src/front/spv/next_block.rs:1512-1517 | naga/src/front/spv/next_block.rs:2364-2372 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (5 lines × 4) · ×2
  • Duplicated block (5 lines × 4) naga/src/back/glsl/writer.rs:2181 — naga/src/back/glsl/writer.rs:2181-2185 | naga/src/back/hlsl/writer.rs:2952-2956 | naga/src/back/msl/writer.rs:4336-4340 | naga/src/back/wgsl/writer.rs:1115-1119 — `naga/src/back/glsl/writer.rs` and `naga/src/back/hlsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 86 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (5 lines × 4) naga/src/back/hlsl/help.rs:968 — naga/src/back/hlsl/help.rs:968-972 | naga/src/back/hlsl/help.rs:1032-1036 | naga/src/back/hlsl/help.rs:1092-1096 | naga/src/back/hlsl/help.rs:1170-1174 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D1 · Cyclomatic Complexity · VaryingContext · ×1
  • VaryingContext::validate_impl (cyclomatic 133) naga/src/valid/interface.rs:234 — VaryingContext::validate_impl has cyclomatic complexity 133 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · CapabilitiesQuery · ×1
  • CapabilitiesQuery::new (cyclomatic 133) wgpu-hal/src/metal/adapter.rs:675 — CapabilitiesQuery::new has cyclomatic complexity 133 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Error · ×1
  • Error::as_parse_error (cyclomatic 123) naga/src/front/wgsl/error.rs:678 — Error::as_parse_error has cyclomatic complexity 123 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · PrivateCapabilities · ×1
  • PrivateCapabilities::map_texture_format (cyclomatic 122) wgpu-hal/src/vulkan/conv.rs:6 — PrivateCapabilities::map_texture_format has cyclomatic complexity 122 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · PrivateTextureFormatCapabilities · ×1
  • PrivateTextureFormatCapabilities::map_format (cyclomatic 120) wgpu-hal/src/metal/adapter.rs:1675 — PrivateTextureFormatCapabilities::map_format has cyclomatic complexity 120 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · ResolveContext · ×1
  • ResolveContext::resolve (cyclomatic 101) naga/src/proc/typifier.rs:265 — ResolveContext::resolve has cyclomatic complexity 101 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · Lexer · ×1
  • Lexer::next (cyclomatic 90) naga/src/front/glsl/lex.rs:46 — Lexer::next has cyclomatic complexity 90 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · TextureFormat · ×1
  • TextureFormat::guaranteed_format_features (cyclomatic 82) wgpu-types/src/texture/format.rs:914 — TextureFormat::guaranteed_format_features has cyclomatic complexity 82 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · StatementGraph · ×1
  • StatementGraph::add (cyclomatic 71) naga/src/back/dot/mod.rs:65 — StatementGraph::add has cyclomatic complexity 71 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · Context · ×1
  • Context::lower_inner (cyclomatic 71) naga/src/front/glsl/context.rs:544 — Context::lower_inner has cyclomatic complexity 71 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · RenderPassInfo · ×1
  • RenderPassInfo::start (cyclomatic 59) wgpu-core/src/command/render.rs:1218 — 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:1922 — InstanceShared::inspect has cyclomatic complexity 59 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Player · ×1
  • Player::process (cyclomatic 54) player/src/lib.rs:100 — Player::process has cyclomatic complexity 54 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · Texture · ×1
  • Texture::create_view_inner (cyclomatic 48) wgpu-core/src/resource.rs:1856 — Texture::create_view_inner has cyclomatic complexity 48 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PhysicalDeviceProperties · ×1
  • PhysicalDeviceProperties::get_required_extensions (cyclomatic 48) wgpu-hal/src/vulkan/adapter.rs:1247 — PhysicalDeviceProperties::get_required_extensions has cyclomatic complexity 48 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · wgpu_xtask · ×1
  • wgpu_xtask::cts::run_cts (cyclomatic 45) xtask/src/cts.rs:66 — wgpu_xtask::cts::run_cts has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ResolvedBinding · ×1
  • ResolvedBinding::try_fmt (cyclomatic 41) naga/src/back/msl/mod.rs:646 — ResolvedBinding::try_fmt has cyclomatic complexity 41 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · MacroCall · ×1
  • MacroCall::call (cyclomatic 41) naga/src/front/glsl/builtins.rs:1588 — MacroCall::call has cyclomatic complexity 41 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · TypeContext · ×1
  • TypeContext::fmt (cyclomatic 34) naga/src/back/msl/writer.rs:220 — TypeContext::fmt has cyclomatic complexity 34 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: Writer::write_unpacking_function (cyclomatic 43) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · ExpressionTracer · ×1
  • ExpressionTracer::trace_expression (cyclomatic 34) naga/src/compact/expressions.rs:76 — ExpressionTracer::trace_expression has cyclomatic complexity 34 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · FunctionTracer · ×1
  • FunctionTracer::trace_block (cyclomatic 33) naga/src/compact/statements.rs:9 — FunctionTracer::trace_block has cyclomatic complexity 33 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions. This shape REPEATS in the file: one other method here (FunctionMap::adjust_body) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · FunctionMap · ×1
  • FunctionMap::adjust_body (cyclomatic 33) naga/src/compact/statements.rs:239 — FunctionMap::adjust_body has cyclomatic complexity 33 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions. This shape REPEATS in the file: one other method here (FunctionTracer::trace_block) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · naga_cli · ×1
  • naga_cli::bin::naga::run (cyclomatic 31) naga-cli/src/bin/naga.rs:484 — naga_cli::bin::naga::run has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Inner · ×1
  • Inner::create (cyclomatic 29) wgpu-hal/src/gles/egl.rs:408 — Inner::create has cyclomatic complexity 29 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · player · ×1
  • player::bin::play::main (cyclomatic 27) player/src/bin/play.rs:4 — player::bin::play::main has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Namer · ×1
  • Namer::reset (cyclomatic 26) naga/src/proc/namer.rs:235 — Namer::reset has cyclomatic complexity 26 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D1 · Cyclomatic Complexity · RenderBundle · ×1
  • RenderBundle::execute (cyclomatic 26) wgpu-core/src/command/bundle.rs:1503 — RenderBundle::execute has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · wgpu_hal · ×1
  • wgpu_hal::vulkan::instance::debug_utils_messenger_callback (cyclomatic 23) wgpu-hal/src/vulkan/instance.rs:18 — wgpu_hal::vulkan::instance::debug_utils_messenger_callback has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · lock_analyzer · ×1
  • lock_analyzer::main (cyclomatic 22) lock-analyzer/src/main.rs:29 — lock_analyzer::main has cyclomatic complexity 22 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D1 · Cyclomatic Complexity · Module · ×1
  • Module::analyze_mesh_shader_info (cyclomatic 22) naga/src/proc/mod.rs:757 — Module::analyze_mesh_shader_info has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: MathFunction::argument_count (cyclomatic 79) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · Buffer · ×1
  • Buffer::try_map_async (cyclomatic 20) wgpu-core/src/resource.rs:747 — Buffer::try_map_async has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CoreDevice · ×1
  • CoreDevice::create_bind_group (cyclomatic 19) wgpu/src/backend/wgpu_core.rs:1023 — CoreDevice::create_bind_group has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Options · ×1
  • Options::resolve_local_binding (cyclomatic 17) naga/src/back/msl/mod.rs:468 — Options::resolve_local_binding has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WebCommandEncoder · ×1
  • WebCommandEncoder::begin_render_pass (cyclomatic 17) wgpu/src/backend/webgpu.rs:3458 — WebCommandEncoder::begin_render_pass has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: wgpu::backend::webgpu::map_texture_format (cyclomatic 97) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · LiteralVector · ×1
  • LiteralVector::from_literal_vec (cyclomatic 16) naga/src/proc/constant_evaluator.rs:345 — LiteralVector::from_literal_vec has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: ConstantEvaluator::try_eval_and_append_impl (cyclomatic 30) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D15 · Churn × Complexity Hotspots · Repeated repair · ×1
  • Repeated repair: wgpu-core/src/command/memory_init.rs wgpu-core/src/command/memory_init.rs:350 — wgpu-core/src/command/memory_init.rs changed 4 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is BakedCommands::initialize_texture_memory at line 350), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(core): Init tracking for pass with multiple depth slice attachments”; “fix(core): Fix init tracking for 3D textures as render attachments”; “fix(core): Avoid overlapping locks in `initialize_texture_memory`”; “fix(core): Lose device on errors during critical part of submission”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 06:46:29 +00:00' --until='2026-09-27 06:46:29 +00:00' --full-history --no-merges -- wgpu-core/src/command/memory_init.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
D17 · Explicit Debt · TodoComment repeated across 17 files · ×1
  • TodoComment repeated across 17 files deno_webgpu/texture.rs:89 — The identical TodoComment appears in 17 files (19 occurrences) — almost certainly one boilerplate line from a single migration or decision, not 19 independent debts. Fix the systemic cause once rather than file-by-file. Text: "// TODO(@crowlKats): no-op, needs wpgu to implement changing the label". Source code is not a task system: track the cleanup where tasks live. (Every occurrence still counts toward the score and metrics.)
D2 · Cognitive Complexity · CapabilitiesQuery · ×1
  • CapabilitiesQuery::new (cognitive 158) wgpu-hal/src/metal/adapter.rs:675 — CapabilitiesQuery::new has cognitive complexity 158 (threshold 15). Drivers by points: if/else 79 (81 pts), boolean chains 75, loops 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Context · ×1
  • Context::lower_inner (cognitive 139) naga/src/front/glsl/context.rs:544 — Context::lower_inner has cognitive complexity 139 (threshold 15). Drivers by points: if/else 29 (66 pts), match/switch 21 (53 pts), loops 5 (18 pts), boolean chains 2 (nesting depth added 82). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · RenderPassInfo · ×1
  • RenderPassInfo::start (cognitive 107) wgpu-core/src/command/render.rs:1218 — 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:1922 — InstanceShared::inspect has cognitive complexity 99 (threshold 15). Drivers by points: if/else 43 (83 pts), boolean chains 16 (nesting depth added 40). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ResolveContext · ×1
  • ResolveContext::resolve (cognitive 89) naga/src/proc/typifier.rs:265 — ResolveContext::resolve has cognitive complexity 89 (threshold 15). Drivers by points: match/switch 22 (54 pts), if/else 14 (35 pts) (nesting depth added 53). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · StatementGraph · ×1
  • StatementGraph::add (cognitive 76) naga/src/back/dot/mod.rs:65 — StatementGraph::add has cognitive complexity 76 (threshold 15). Drivers by points: if/else 16 (38 pts), match/switch 8 (25 pts), loops 5 (13 pts) (nesting depth added 47). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · lock_analyzer · ×1
  • lock_analyzer::main (cognitive 55) lock-analyzer/src/main.rs:29 — lock_analyzer::main has cognitive complexity 55 (threshold 15). Drivers by points: loops 8 (23 pts), if/else 8 (19 pts), match/switch 3 (11 pts), boolean chains 2 (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PhysicalDeviceProperties · ×1
  • PhysicalDeviceProperties::get_required_extensions (cognitive 53) wgpu-hal/src/vulkan/adapter.rs:1247 — PhysicalDeviceProperties::get_required_extensions has cognitive complexity 53 (threshold 15). Drivers by points: if/else 46 (51 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Texture · ×1
  • Texture::create_view_inner (cognitive 51) wgpu-core/src/resource.rs:1856 — Texture::create_view_inner has cognitive complexity 51 (threshold 15). Drivers by points: if/else 31 (35 pts), boolean chains 9, match/switch 6 (7 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · FunctionTracer · ×1
  • FunctionTracer::trace_block (cognitive 50) naga/src/compact/statements.rs:9 — FunctionTracer::trace_block has cognitive complexity 50 (threshold 15). Drivers by points: if/else 6 (24 pts), loops 5 (15 pts), match/switch 3 (11 pts) (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (FunctionMap::adjust_body) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · FunctionMap · ×1
  • FunctionMap::adjust_body (cognitive 50) naga/src/compact/statements.rs:239 — FunctionMap::adjust_body has cognitive complexity 50 (threshold 15). Drivers by points: if/else 6 (24 pts), loops 5 (15 pts), match/switch 3 (11 pts) (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (FunctionTracer::trace_block) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · MacroCall · ×1
  • MacroCall::call (cognitive 47) naga/src/front/glsl/builtins.rs:1588 — MacroCall::call has cognitive complexity 47 (threshold 15). Drivers by points: match/switch 9 (23 pts), if/else 10 (20 pts), loops 1 (4 pts) (nesting depth added 27). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · naga_cli · ×1
  • naga_cli::bin::naga::run (cognitive 44) naga-cli/src/bin/naga.rs:484 — naga_cli::bin::naga::run has cognitive complexity 44 (threshold 15). Drivers by points: if/else 27 (36 pts), match/switch 5 (7 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · player · ×1
  • player::bin::play::main (cognitive 41) player/src/bin/play.rs:4 — player::bin::play::main has cognitive complexity 41 (threshold 15). Drivers by points: if/else 11 (31 pts), match/switch 4 (6 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Entry · ×1
  • Entry::check (cognitive 40) wgpu-core/src/command/bind.rs:71 — Entry::check has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (28 pts), loops 2 (8 pts), match/switch 1 (4 pts) (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · CommandBufferMutable · ×1
  • CommandBufferMutable::validate_acceleration_structure_actions (cognitive 36) wgpu-core/src/command/ray_tracing.rs:484 — CommandBufferMutable::validate_acceleration_structure_actions has cognitive complexity 36 (threshold 15). Drivers by points: if/else 4 (16 pts), loops 5 (14 pts), match/switch 2 (6 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Inner · ×1
  • Inner::create (cognitive 36) wgpu-hal/src/gles/egl.rs:408 — Inner::create has cognitive complexity 36 (threshold 15). Drivers by points: if/else 20 (21 pts), match/switch 5 (10 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · TypeContext · ×1
  • TypeContext::fmt (cognitive 35) naga/src/back/msl/writer.rs:220 — TypeContext::fmt has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (22 pts), match/switch 7 (12 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DeviceShared · ×1
  • DeviceShared::make_render_pass (cognitive 31) wgpu-hal/src/vulkan/device.rs:76 — DeviceShared::make_render_pass has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (27 pts), loops 1 (2 pts), boolean chains 1, match/switch 1 (nesting depth added 16). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Error · ×1
  • Error::as_parse_error (cognitive 27) naga/src/front/wgsl/error.rs:678 — Error::as_parse_error has cognitive complexity 27 (threshold 15). Drivers by points: match/switch 8 (16 pts), if/else 7 (11 pts) (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · RenderBundle · ×1
  • RenderBundle::execute (cognitive 27) wgpu-core/src/command/bundle.rs:1503 — RenderBundle::execute has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (19 pts), match/switch 2 (5 pts), boolean chains 2, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Buffer · ×1
  • Buffer::try_map_async (cognitive 25) wgpu-core/src/resource.rs:747 — Buffer::try_map_async has cognitive complexity 25 (threshold 15). Drivers by points: if/else 17 (20 pts), match/switch 3 (4 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · deno_webgpu · ×1
  • deno_webgpu::get_data_slice (cognitive 22) deno_webgpu/lib.rs:378 — deno_webgpu::get_data_slice has cognitive complexity 22 (threshold 15). Drivers by points: if/else 17 (22 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · TypedGlobalVariable · ×1
  • TypedGlobalVariable::to_parts (cognitive 22) naga/src/back/msl/writer.rs:414 — TypedGlobalVariable::to_parts has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 4 (8 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WebCommandEncoder · ×1
  • WebCommandEncoder::begin_render_pass (cognitive 22) wgpu/src/backend/webgpu.rs:3458 — WebCommandEncoder::begin_render_pass has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 4 (7 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CoreDevice · ×1
  • CoreDevice::create_bind_group (cognitive 22) wgpu/src/backend/wgpu_core.rs:1023 — CoreDevice::create_bind_group has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 3 (6 pts), match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Function · ×1
  • Function::to_words (cognitive 21) naga/src/back/spv/writer.rs:36 — Function::to_words has cognitive complexity 21 (threshold 15). Drivers by points: loops 8 (19 pts), if/else 1 (2 pts) (nesting depth added 12). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · RequestAdapterError · ×1
  • RequestAdapterError::fmt (cognitive 21) wgpu-types/src/adapter.rs:279 — RequestAdapterError::fmt has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (18 pts), loops 1 (2 pts), match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Options · ×1
  • Options::resolve_local_binding (cognitive 20) naga/src/back/msl/mod.rs:468 — Options::resolve_local_binding has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (13 pts), match/switch 3 (5 pts), boolean chains 2 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · VertexLimits · ×1
  • VertexLimits::new (cognitive 19) wgpu-core/src/command/render.rs:442 — VertexLimits::new has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (16 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InitTrackerDrain · ×1
  • InitTrackerDrain::next (cognitive 18) wgpu-core/src/init_tracker/mod.rs:111 — InitTrackerDrain::next has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PrivateCapabilities · ×1
  • PrivateCapabilities::map_texture_format (cognitive 18) wgpu-hal/src/vulkan/conv.rs:6 — PrivateCapabilities::map_texture_format has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), match/switch 5 (8 pts) (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ModuleTracer · ×1
  • ModuleTracer::type_expression_tandem (cognitive 17) naga/src/compact/mod.rs:473 — ModuleTracer::type_expression_tandem has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (7 pts), loops 4 (5 pts), match/switch 2 (5 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ShaderStagesBits · ×1
  • ShaderStagesBits::write_hex (cognitive 17) wgpu-types/src/binding.rs:196 — ShaderStagesBits::write_hex has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (7 pts), loops 2 (6 pts), boolean chains 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BufferUsagesBits · ×1
  • BufferUsagesBits::write_hex (cognitive 17) wgpu-types/src/buffer.rs:47 — BufferUsagesBits::write_hex has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (7 pts), loops 2 (6 pts), boolean chains 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FeatureBits · ×1
  • FeatureBits::write_hex (cognitive 17) wgpu-types/src/features.rs:102 — FeatureBits::write_hex has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (7 pts), loops 2 (6 pts), boolean chains 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Player · ×1
  • Player::process (cognitive 16) player/src/lib.rs:100 — Player::process has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 pts), match/switch 1 (nesting depth added 5). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · BindGroupLayoutEntry · ×1
  • BindGroupLayoutEntry::try_into (cognitive 16) wgpu-core/src/binding_model.rs:1046 — BindGroupLayoutEntry::try_into has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (16 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InitTracker · ×1
  • InitTracker::discard (cognitive 16) wgpu-core/src/init_tracker/mod.rs:261 — InitTracker::discard has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (16 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CompilationContext · ×1
  • CompilationContext::consume_reflection (cognitive 16) wgpu-hal/src/gles/device.rs:37 — CompilationContext::consume_reflection has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 4 (8 pts), if/else 3 (5 pts), loops 3 (nesting depth added 6). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D22 · Internal API Consistency · Inconsistent error handling and access patterns for handle lookup. `try_get` returns a Result (implying Option-like behavior or error), `get_mut` panics or returns directly (unsafe/panic-on-missing), and `check_contains_handle` is a separate boolean/check operation. This forces users to choose between three different patterns for essentially the same intent · ×1
  • Inconsistent error handling and access patterns for handle lookup. `try_get` returns a Result (implying Option-like behavior or error), `get_mut` panics or returns directly (unsafe/panic-on-missing), and `check_contains_handle` is a separate boolean/check operation. This forces users to choose between three different patterns for essentially the same intent: 'does this handle exist and can I access it?'. — Unify to a consistent pattern, e.g., `get(handle)` returning `Option<&T>` and `get_mut(handle)` returning `Option<&mut T>`, removing `try_get` and `check_contains_handle`. (signatures: Arena.try_get(handle: Handle): Result | Arena.get_mut(handle: Handle): T | Arena.check_contains_handle(handle: Handle): Result)
D22 · Internal API Consistency · Overlapping and confusingly named insertion/fetch operations. `fetch_if_or_append` and `fetch_or_append` are very similar, differing only by the presence of a predicate function. `append` is a simple insertion. The naming convention `fetch_*` suggests retrieval but these are primarily insertion/lookup hybrids. `fetch_if` is ambiguous · ×1
  • Overlapping and confusingly named insertion/fetch operations. `fetch_if_or_append` and `fetch_or_append` are very similar, differing only by the presence of a predicate function. `append` is a simple insertion. The naming convention `fetch_*` suggests retrieval but these are primarily insertion/lookup hybrids. `fetch_if` is ambiguous: does it fetch if a condition is met, or fetch and then apply a condition? — Clarify intent. If these are 'get or create' patterns, use consistent names like `get_or_insert`, `get_or_insert_with`, etc. Remove `fetch_if` if it's redundant with `fetch_if_or_append` with a nullary function, or rename to `try_get`. (signatures: Arena.append(value: T, span: Span): Handle | Arena.fetch_if(fun: F): Handle | Arena.fetch_if_or_append(value: T, span: Span, fun: F): Handle | Arena.fetch_or_append(value: T, span: Span): Handle)
D22 · Internal API Consistency · Inconsistent naming for block modification operations. `push` adds a single item, `append` adds another block, `extend` adds items (but takes `u64` which is suspicious for a block of statements), and `extend_block` is redundant with `append`. `push` vs `append` vs `extend` is a common Rust pattern, but `append` taking a `Self` (another Block) is non-standard (usually `extend` takes an iterator or `push` takes a single item). `extend` taking `u64` is likely a bug or very specific internal use, breaking the iterator-like naming convention. · ×1
  • Inconsistent naming for block modification operations. `push` adds a single item, `append` adds another block, `extend` adds items (but takes `u64` which is suspicious for a block of statements), and `extend_block` is redundant with `append`. `push` vs `append` vs `extend` is a common Rust pattern, but `append` taking a `Self` (another Block) is non-standard (usually `extend` takes an iterator or `push` takes a single item). `extend` taking `u64` is likely a bug or very specific internal use, breaking the iterator-like naming convention. — Standardize on `push` for single items, `extend` for iterators/other blocks. Remove `append` and `extend_block` as duplicates. Investigate `extend(item: u64)`. (signatures: Block.push(end: Statement, span: Span) | Block.append(other: Self) | Block.extend(item: u64) | Block.extend_block(other: Self))
D22 · Internal API Consistency · Inconsistent naming for version/target specification across backends. HLSL uses `shader_model`, MSL and GLSL use `lang_version` or `version`. This makes it hard to configure a generic pipeline or understand the target version without knowing the specific backend's property name. · ×1
  • Inconsistent naming for version/target specification across backends. HLSL uses `shader_model`, MSL and GLSL use `lang_version` or `version`. This makes it hard to configure a generic pipeline or understand the target version without knowing the specific backend's property name. — Unify to a common property name like `target_version` or `api_version` across all backends, or provide a unified abstraction in a higher-level API. (signatures: Options.shader_model: ShaderModel | Options.lang_version: (u8, u8) | Options.version: Version)
D22 · Internal API Consistency · Inconsistent naming for compatibility/fallback flags. `fake_missing_bindings` is specific to HLSL/MSL, while `spirv_cross_compatibility` is specific to MSL. These are both 'compatibility' or 'fallback' modes but named differently, making it hard to apply consistent configuration across backends. · ×1
  • Inconsistent naming for compatibility/fallback flags. `fake_missing_bindings` is specific to HLSL/MSL, while `spirv_cross_compatibility` is specific to MSL. These are both 'compatibility' or 'fallback' modes but named differently, making it hard to apply consistent configuration across backends. — Use consistent naming for similar compatibility flags, e.g., `enable_spirv_cross_compatibility` and `enable_missing_binding_fallback` or unify into a `compatibility_mode` enum. (signatures: Options.fake_missing_bindings: bool | Options.spirv_cross_compatibility: bool)
D35 · Change Coupling · Change coupling clique · ×1
  • Change coupling clique: buffer.rs, stateless.rs, texture.rs wgpu-core/src/track/buffer.rs — 3 files — `wgpu-core/src/track/buffer.rs`, `wgpu-core/src/track/stateless.rs`, `wgpu-core/src/track/texture.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: draw.rs ↔ mod.rs wgpu-core/src/indirect_validation/draw.rs — `wgpu-core/src/indirect_validation/draw.rs` and `wgpu-core/src/timestamp_normalization/mod.rs` change together 64% of the time (7 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `10ce22b2` refactor!: subvert-rename `dispatch*` to `dispatchWorkGroups*` (#9362); `ce7dad30` fix: Change type of `max_*_buffer_binding_size` to follow spec; `ee46a451` Add labels to indirect validation and timestamp normalization code (#… — run `git show` on any of them.
D4 · Code Duplication · Edited copy of a member (15 corresponding lines) · ×1
  • Edited copy of a member (15 corresponding lines) naga/src/front/wgsl/error.rs:91 — naga/src/front/wgsl/error.rs:91-107 | naga/src/span.rs:288-305 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (6 members, 50+ identical tokens) naga/src/back/dot/mod.rs:65 — naga/src/back/dot/mod.rs:65-447 | naga/src/back/glsl/writer.rs:1614-2294 | naga/src/back/msl/writer.rs:3928-4505 | naga/src/back/wgsl/writer.rs:752-1259 | naga/src/valid/analyzer.rs:886-1234 | naga/src/valid/function.rs:730-786 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
D4 · Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (5 members, 50+ identical tokens) naga/src/front/spv/mod.rs:2160 — naga/src/front/spv/mod.rs:2160-2189 | naga/src/front/spv/mod.rs:2258-2291 | naga/src/front/spv/mod.rs:2313-2377 | naga/src/front/spv/mod.rs:2383-2464 | naga/src/front/spv/mod.rs:2627-2717 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication · Duplicated block (73–74 lines × 2) · ×1
  • Duplicated block (73–74 lines × 2) naga/src/front/glsl/context.rs:840 — naga/src/front/glsl/context.rs:840-912 | naga/src/front/glsl/context.rs:920-993 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (44 lines × 3) · ×1
  • Duplicated block (44 lines × 3) wgpu-core/src/device/resource.rs:5096 — wgpu-core/src/device/resource.rs:5096-5139 | wgpu-core/src/device/resource.rs:5148-5191 | wgpu-core/src/device/resource.rs:5198-5241 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (44 lines × 2) · ×1
  • Duplicated block (44 lines × 2) naga/src/back/glsl/writer.rs:2179 — naga/src/back/glsl/writer.rs:2179-2222 | naga/src/back/wgsl/writer.rs:1113-1156 — `naga/src/back/glsl/writer.rs` and `naga/src/back/wgsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 135 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (40 lines × 2) · ×1
  • Duplicated block (40 lines × 2) naga/src/front/spv/next_block.rs:1116 — naga/src/front/spv/next_block.rs:1116-1155 | naga/src/front/spv/next_block.rs:1184-1223 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (37 lines × 2) · ×1
  • Duplicated block (37 lines × 2) naga/src/back/spv/block.rs:1840 — naga/src/back/spv/block.rs:1840-1876 | naga/src/back/spv/block.rs:1890-1926 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (36 lines × 2) · ×1
  • Duplicated block (36 lines × 2) wgpu-types/src/texture/format.rs:1355 — wgpu-types/src/texture/format.rs:1355-1390 | wgpu-types/src/texture/format.rs:1439-1474 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (33–34 lines × 3) · ×1
  • Duplicated block (33–34 lines × 3) deno_webgpu/compute_pass.rs:127 — deno_webgpu/compute_pass.rs:127-159 | deno_webgpu/render_bundle.rs:121-153 | deno_webgpu/render_pass.rs:182-215 — before extracting anything, compare `deno_webgpu/compute_pass.rs` and `deno_webgpu/render_pass.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 70 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (33–34 lines × 2) · ×1
  • Duplicated block (33–34 lines × 2) naga/src/front/glsl/builtins.rs:974 — naga/src/front/glsl/builtins.rs:974-1007 | naga/src/front/glsl/builtins.rs:1130-1162 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (32 lines × 2) · ×1
  • Duplicated block (32 lines × 2) wgpu-core/src/device/queue.rs:1072 — wgpu-core/src/device/queue.rs:1072-1103 | wgpu-core/src/device/queue.rs:1364-1395 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (28 lines × 2) · ×1
  • Duplicated block (28 lines × 2) naga/src/front/spv/next_block.rs:935 — naga/src/front/spv/next_block.rs:935-962 | naga/src/front/spv/next_block.rs:1010-1037 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (26–27 lines × 2) · ×1
  • Duplicated block (26–27 lines × 2) wgpu-hal/src/gles/egl.rs:1405 — wgpu-hal/src/gles/egl.rs:1405-1430 | wgpu-hal/src/gles/wgl.rs:798-824 — before extracting anything, compare `wgpu-hal/src/gles/egl.rs` and `wgpu-hal/src/gles/wgl.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 73 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (18–26 lines × 2) · ×1
  • Duplicated block (18–26 lines × 2) naga/src/back/hlsl/writer.rs:3767 — naga/src/back/hlsl/writer.rs:3767-3784 | naga/src/back/wgsl/writer.rs:1513-1538 — `naga/src/back/hlsl/writer.rs` and `naga/src/back/wgsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 18 separate duplicated blocks between them, totalling at least 185 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (23–25 lines × 2) · ×1
  • Duplicated block (23–25 lines × 2) wgpu-core/src/command/query.rs:331 — wgpu-core/src/command/query.rs:331-353 | wgpu-core/src/command/query.rs:387-411 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (21–24 lines × 2) · ×1
  • Duplicated block (21–24 lines × 2) naga/src/back/msl/writer.rs:6013 — naga/src/back/msl/writer.rs:6013-6036 | naga/src/back/msl/writer.rs:6103-6123 — both copies are in the same file, so extract the 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 (20–23 lines × 4) · ×1
  • Duplicated block (20–23 lines × 4) wgpu-core/src/device/resource.rs:5116 — wgpu-core/src/device/resource.rs:5116-5135 | wgpu-core/src/device/resource.rs:5168-5187 | wgpu-core/src/device/resource.rs:5218-5237 | wgpu-core/src/device/resource.rs:5275-5297 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (22–23 lines × 3) · ×1
  • Duplicated block (22–23 lines × 3) naga/src/front/glsl/context.rs:668 — naga/src/front/glsl/context.rs:668-689 | naga/src/front/glsl/context.rs:874-896 | naga/src/front/glsl/context.rs:955-977 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (23 lines × 3) · ×1
  • Duplicated block (23 lines × 3) naga/src/front/spv/mod.rs:1087 — naga/src/front/spv/mod.rs:1087-1109 | naga/src/front/spv/mod.rs:1165-1187 | naga/src/front/spv/mod.rs:1240-1262 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (20–22 lines × 2) · ×1
  • Duplicated block (20–22 lines × 2) naga/src/back/spv/writer.rs:1397 — naga/src/back/spv/writer.rs:1397-1416 | naga/src/back/spv/writer.rs:1429-1450 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (15–21 lines × 2) · ×1
  • Duplicated block (15–21 lines × 2) naga/src/back/msl/writer.rs:5997 — naga/src/back/msl/writer.rs:5997-6011 | naga/src/back/msl/writer.rs:6081-6101 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (18–20 lines × 3) · ×1
  • Duplicated block (18–20 lines × 3) naga/src/back/spv/block.rs:1859 — naga/src/back/spv/block.rs:1859-1876 | naga/src/back/spv/block.rs:1909-1926 | naga/src/back/spv/image.rs:436-455 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (18–19 lines × 2) · ×1
  • Duplicated block (18–19 lines × 2) wgpu-core/src/command/transfer.rs:1299 — wgpu-core/src/command/transfer.rs:1299-1317 | wgpu-core/src/command/transfer.rs:1422-1439 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (18 lines × 3) · ×1
  • Duplicated block (18 lines × 3) naga/src/front/spv/next_block.rs:2675 — naga/src/front/spv/next_block.rs:2675-2692 | naga/src/front/spv/next_block.rs:2756-2773 | naga/src/front/spv/next_block.rs:2811-2828 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (15–18 lines × 2) · ×1
  • Duplicated block (15–18 lines × 2) naga/src/back/glsl/writer.rs:2788 — naga/src/back/glsl/writer.rs:2788-2802 | naga/src/back/glsl/writer.rs:4316-4333 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (16–18 lines × 2) · ×1
  • Duplicated block (16–18 lines × 2) naga/src/back/spv/image.rs:881 — naga/src/back/spv/image.rs:881-898 | naga/src/back/spv/image.rs:901-916 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (16–17 lines × 2) · ×1
  • Duplicated block (16–17 lines × 2) wgpu-core/src/device/resource.rs:837 — wgpu-core/src/device/resource.rs:837-852 | wgpu-core/src/device/resource.rs:858-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.
D4 · Code Duplication · Duplicated block (16 lines × 3) · ×1
  • Duplicated block (16 lines × 3) wgpu/src/backend/webgpu.rs:3716 — wgpu/src/backend/webgpu.rs:3716-3731 | wgpu/src/backend/webgpu.rs:3812-3827 | wgpu/src/backend/webgpu.rs:4099-4114 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (12–16 lines × 2) · ×1
  • Duplicated block (12–16 lines × 2) naga/src/back/wgsl/writer.rs:2067 — naga/src/back/wgsl/writer.rs:2067-2082 | naga/src/back/wgsl/writer.rs:2124-2135 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (14–15 lines × 3) · ×1
  • Duplicated block (14–15 lines × 3) naga/src/back/hlsl/help.rs:1400 — naga/src/back/hlsl/help.rs:1400-1414 | naga/src/back/hlsl/help.rs:1442-1456 | naga/src/back/hlsl/help.rs:1511-1524 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (15 lines × 3) · ×1
  • Duplicated block (15 lines × 3) naga/src/front/spv/mod.rs:2140 — naga/src/front/spv/mod.rs:2140-2154 | naga/src/front/spv/mod.rs:2175-2189 | naga/src/front/spv/mod.rs:2202-2216 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (13–15 lines × 2) · ×1
  • Duplicated block (13–15 lines × 2) wgpu-core/src/indirect_validation/dispatch.rs:196 — wgpu-core/src/indirect_validation/dispatch.rs:196-208 | wgpu-core/src/indirect_validation/draw.rs:130-144 — before extracting anything, compare `wgpu-core/src/indirect_validation/dispatch.rs` and `wgpu-core/src/indirect_validation/draw.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 92 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 (13–14 lines × 4) · ×1
  • Duplicated block (13–14 lines × 4) wgpu-core/src/device/resource.rs:5103 — wgpu-core/src/device/resource.rs:5103-5115 | wgpu-core/src/device/resource.rs:5155-5167 | wgpu-core/src/device/resource.rs:5205-5217 | wgpu-core/src/device/resource.rs:5260-5273 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (14 lines × 3) · ×1
  • Duplicated block (14 lines × 3) naga/src/front/wgsl/lower/mod.rs:3796 — naga/src/front/wgsl/lower/mod.rs:3796-3809 | naga/src/front/wgsl/lower/mod.rs:3819-3832 | naga/src/front/wgsl/lower/mod.rs:3842-3855 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (13–14 lines × 2) · ×1
  • Duplicated block (13–14 lines × 2) wgpu-core/src/command/mod.rs:1126 — wgpu-core/src/command/mod.rs:1126-1139 | wgpu-core/src/command/mod.rs:1218-1230 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (11–13 lines × 3) · ×1
  • Duplicated block (11–13 lines × 3) naga/src/front/wgsl/parse/number.rs:188 — naga/src/front/wgsl/parse/number.rs:188-198 | naga/src/front/wgsl/parse/number.rs:217-229 | naga/src/front/wgsl/parse/number.rs:275-285 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (12–13 lines × 3) · ×1
  • Duplicated block (12–13 lines × 3) wgpu-core/src/command/render.rs:4236 — wgpu-core/src/command/render.rs:4236-4247 | wgpu-core/src/command/render.rs:4285-4297 | wgpu-core/src/command/render.rs:4338-4350 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (12–13 lines × 2) · ×1
  • Duplicated block (12–13 lines × 2) naga/src/back/spv/index.rs:375 — naga/src/back/spv/index.rs:375-387 | naga/src/back/spv/index.rs:439-450 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (11–12 lines × 2) · ×1
  • Duplicated block (11–12 lines × 2) naga/src/front/spv/mod.rs:2877 — naga/src/front/spv/mod.rs:2877-2888 | naga/src/front/spv/mod.rs:2900-2910 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (11 lines × 6) · ×1
  • Duplicated block (11 lines × 6) wgpu-hal/src/gles/queue.rs:499 — wgpu-hal/src/gles/queue.rs:499-509 | wgpu-hal/src/gles/queue.rs:514-524 | wgpu-hal/src/gles/queue.rs:529-539 | wgpu-hal/src/gles/queue.rs:541-553 | wgpu-hal/src/gles/queue.rs:559-569 | wgpu-hal/src/gles/queue.rs:574-584 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (11 lines × 4) · ×1
  • Duplicated block (11 lines × 4) wgpu-hal/src/gles/queue.rs:627 — wgpu-hal/src/gles/queue.rs:627-637 | wgpu-hal/src/gles/queue.rs:640-650 | wgpu-hal/src/gles/queue.rs:653-663 | wgpu-hal/src/gles/queue.rs:679-689 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (9–11 lines × 3) · ×1
  • Duplicated block (9–11 lines × 3) naga/src/back/hlsl/writer.rs:3459 — naga/src/back/hlsl/writer.rs:3459-3467 | naga/src/back/wgsl/writer.rs:1627-1637 | naga/src/back/wgsl/writer.rs:1701-1711 — `naga/src/back/hlsl/writer.rs` and `naga/src/back/wgsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 18 separate duplicated blocks between them, totalling at least 185 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (10–11 lines × 3) · ×1
  • Duplicated block (10–11 lines × 3) naga/src/front/glsl/parser.rs:273 — naga/src/front/glsl/parser.rs:273-282 | naga/src/front/glsl/parser.rs:351-360 | naga/src/front/glsl/parser.rs:380-390 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (8–11 lines × 3) · ×1
  • Duplicated block (8–11 lines × 3) naga/src/front/spv/next_block.rs:964 — naga/src/front/spv/next_block.rs:964-974 | naga/src/front/spv/next_block.rs:1098-1106 | naga/src/front/spv/next_block.rs:2963-2970 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (10–11 lines × 2) · ×1
  • Duplicated block (10–11 lines × 2) naga/src/back/spv/mesh_shader.rs:468 — naga/src/back/spv/mesh_shader.rs:468-478 | naga/src/back/spv/mesh_shader.rs:491-500 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (8–11 lines × 2) · ×1
  • Duplicated block (8–11 lines × 2) wgpu/src/backend/wgpu_core.rs:2053 — wgpu/src/backend/wgpu_core.rs:2053-2063 | wgpu/src/backend/wgpu_core.rs:2105-2112 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (6–10 lines × 10) · ×1
  • Duplicated block (6–10 lines × 10) naga/src/front/spv/next_block.rs:462 — naga/src/front/spv/next_block.rs:462-468 | naga/src/front/spv/next_block.rs:539-545 | naga/src/front/spv/next_block.rs:1073-1078 | naga/src/front/spv/next_block.rs:1105-1110 | naga/src/front/spv/next_block.rs:1175-1180 | naga/src/front/spv/next_block.rs:1270-1275 | naga/src/front/spv/next_block.rs:1484-1490 | naga/src/front/spv/next_block.rs:2364-2373 | naga/src/front/spv/next_block.rs:2715-2721 | naga/src/front/spv/next_block.rs:2786-2792 — all 10 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (10 lines × 4) · ×1
  • Duplicated block (10 lines × 4) naga/src/front/spv/mod.rs:2140 — naga/src/front/spv/mod.rs:2140-2149 | naga/src/front/spv/mod.rs:2175-2184 | naga/src/front/spv/mod.rs:2202-2211 | naga/src/front/spv/mod.rs:2238-2247 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (8–10 lines × 3) · ×1
  • Duplicated block (8–10 lines × 3) naga/src/back/glsl/writer.rs:847 — naga/src/back/glsl/writer.rs:847-854 | naga/src/back/hlsl/writer.rs:233-240 | naga/src/back/msl/writer.rs:3706-3715 — `naga/src/back/glsl/writer.rs` and `naga/src/back/hlsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 86 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (4–10 lines × 4) · ×1
  • Duplicated block (4–10 lines × 4) naga/src/front/spv/next_block.rs:2541 — naga/src/front/spv/next_block.rs:2541-2544 | naga/src/front/spv/next_block.rs:2636-2645 | naga/src/front/spv/next_block.rs:2723-2726 | naga/src/front/spv/next_block.rs:2789-2798 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (7–9 lines × 3) · ×1
  • Duplicated block (7–9 lines × 3) naga/src/back/hlsl/help.rs:1066 — naga/src/back/hlsl/help.rs:1066-1072 | naga/src/back/hlsl/help.rs:1140-1148 | naga/src/back/hlsl/help.rs:1217-1225 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (8–9 lines × 3) · ×1
  • Duplicated block (8–9 lines × 3) naga/src/front/spv/mod.rs:1128 — naga/src/front/spv/mod.rs:1128-1135 | naga/src/front/spv/mod.rs:1203-1210 | naga/src/front/spv/mod.rs:1273-1281 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (7–9 lines × 2) · ×1
  • Duplicated block (7–9 lines × 2) naga/src/front/spv/mod.rs:1479 — naga/src/front/spv/mod.rs:1479-1485 | naga/src/front/spv/next_block.rs:2902-2910 — before extracting anything, compare `naga/src/front/spv/mod.rs` and `naga/src/front/spv/next_block.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (6–9 lines × 3) · ×1
  • Duplicated block (6–9 lines × 3) naga/src/front/wgsl/lower/mod.rs:3673 — naga/src/front/wgsl/lower/mod.rs:3673-3681 | naga/src/front/wgsl/lower/mod.rs:3688-3696 | naga/src/front/wgsl/lower/mod.rs:3702-3707 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (7–8 lines × 5) · ×1
  • Duplicated block (7–8 lines × 5) naga/src/back/wgsl/writer.rs:916 — naga/src/back/wgsl/writer.rs:916-922 | naga/src/back/wgsl/writer.rs:945-951 | naga/src/back/wgsl/writer.rs:1625-1632 | naga/src/back/wgsl/writer.rs:1699-1706 | naga/src/back/wgsl/writer.rs:1747-1753 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (7–8 lines × 4) · ×1
  • Duplicated block (7–8 lines × 4) naga/src/front/spv/mod.rs:1070 — naga/src/front/spv/mod.rs:1070-1076 | naga/src/front/spv/mod.rs:1130-1136 | naga/src/front/spv/mod.rs:1205-1211 | naga/src/front/spv/mod.rs:1275-1282 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (4–8 lines × 3) · ×1
  • Duplicated block (4–8 lines × 3) naga/src/back/glsl/writer.rs:2154 — naga/src/back/glsl/writer.rs:2154-2157 | naga/src/back/glsl/writer.rs:2170-2177 | naga/src/back/glsl/writer.rs:2227-2234 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (7 lines × 6) · ×1
  • Duplicated block (7 lines × 6) naga/src/back/dot/mod.rs:379 — naga/src/back/dot/mod.rs:379-385 | naga/src/back/glsl/writer.rs:2274-2280 | naga/src/back/msl/writer.rs:4422-4428 | naga/src/back/wgsl/writer.rs:1206-1212 | naga/src/valid/analyzer.rs:1174-1180 | naga/src/valid/function.rs:732-738 — `naga/src/back/glsl/writer.rs` and `naga/src/back/msl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 66 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (7 lines × 4) · ×1
  • Duplicated block (7 lines × 4) naga/src/front/spv/next_block.rs:1047 — naga/src/front/spv/next_block.rs:1047-1053 | naga/src/front/spv/next_block.rs:1240-1246 | naga/src/front/spv/next_block.rs:1883-1889 | naga/src/front/spv/next_block.rs:2517-2523 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (6–7 lines × 2) · ×1
  • Duplicated block (6–7 lines × 2) naga/src/back/hlsl/help.rs:331 — naga/src/back/hlsl/help.rs:331-336 | naga/src/back/hlsl/help.rs:426-432 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (4–6 lines × 3) · ×1
  • Duplicated block (4–6 lines × 3) naga/src/front/glsl/builtins.rs:925 — naga/src/front/glsl/builtins.rs:925-928 | naga/src/front/glsl/builtins.rs:1079-1084 | naga/src/front/glsl/builtins.rs:1357-1362 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (5 lines × 12) · ×1
  • Duplicated block (5 lines × 12) naga/src/front/spv/next_block.rs:463 — naga/src/front/spv/next_block.rs:463-468 | naga/src/front/spv/next_block.rs:540-545 | naga/src/front/spv/next_block.rs:1049-1053 | naga/src/front/spv/next_block.rs:1074-1078 | naga/src/front/spv/next_block.rs:1106-1110 | naga/src/front/spv/next_block.rs:1176-1180 | naga/src/front/spv/next_block.rs:1242-1246 | naga/src/front/spv/next_block.rs:1271-1275 | naga/src/front/spv/next_block.rs:1485-1490 | naga/src/front/spv/next_block.rs:1884-1889 | naga/src/front/spv/next_block.rs:2365-2373 | naga/src/front/spv/next_block.rs:2716-2721 — all 12 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (5 lines × 6) · ×1
  • Duplicated block (5 lines × 6) naga/src/back/hlsl/writer.rs:2539 — naga/src/back/hlsl/writer.rs:2539-2544 | naga/src/back/wgsl/writer.rs:916-920 | naga/src/back/wgsl/writer.rs:945-949 | naga/src/back/wgsl/writer.rs:1625-1630 | naga/src/back/wgsl/writer.rs:1699-1704 | naga/src/back/wgsl/writer.rs:1747-1751 — `naga/src/back/hlsl/writer.rs` and `naga/src/back/wgsl/writer.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 18 separate duplicated blocks between them, totalling at least 185 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (6 lines × 8) · ×1
  • Duplicated block (6 lines × 8) wgpu-core/src/command/bundle.rs:1398 — wgpu-core/src/command/bundle.rs:1398-1403 | wgpu-core/src/command/clear.rs:81-86 | wgpu-core/src/command/compute.rs:210-215 | wgpu-core/src/command/mod.rs:1665-1670 | wgpu-core/src/command/render.rs:1005-1010 | wgpu-core/src/device/queue.rs:570-575 | wgpu-core/src/device/queue.rs:608-613 | wgpu-core/src/resource.rs:2781-2786 — before extracting anything, compare `wgpu-core/src/command/bundle.rs` and `wgpu-core/src/command/render.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 83 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (12 lines × 4) · ×1
  • Duplicated block (12 lines × 4) wgpu-core/src/command/compute.rs:1399 — wgpu-core/src/command/compute.rs:1399-1411 | wgpu-core/src/command/compute.rs:1424-1437 | wgpu-core/src/command/render.rs:4441-4452 | wgpu-core/src/command/render.rs:4498-4510 — before extracting anything, compare `wgpu-core/src/command/compute.rs` and `wgpu-core/src/command/render.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 65 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (11 lines × 8) · ×1
  • Duplicated block (11 lines × 8) naga/src/back/msl/writer.rs:5184 — naga/src/back/msl/writer.rs:5184-5196 | naga/src/back/msl/writer.rs:5231-5243 | naga/src/back/msl/writer.rs:5402-5414 | naga/src/back/msl/writer.rs:5458-5468 | naga/src/back/msl/writer.rs:5513-5525 | naga/src/back/msl/writer.rs:5611-5623 | naga/src/back/msl/writer.rs:5827-5847 | naga/src/back/msl/writer.rs:5855-5870 — all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (11 lines × 3) · ×1
  • Duplicated block (11 lines × 3) naga/src/back/msl/writer.rs:5119 — naga/src/back/msl/writer.rs:5119-5129 | naga/src/back/msl/writer.rs:5323-5333 | naga/src/back/msl/writer.rs:5750-5760 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (10 lines × 6) · ×1
  • Duplicated block (10 lines × 6) naga/src/back/msl/writer.rs:5166 — naga/src/back/msl/writer.rs:5166-5176 | naga/src/back/msl/writer.rs:5213-5223 | naga/src/back/msl/writer.rs:5380-5390 | naga/src/back/msl/writer.rs:5437-5446 | naga/src/back/msl/writer.rs:5491-5501 | naga/src/back/msl/writer.rs:5554-5564 — 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.
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 — 11 finding(s)
D16 · Bus Factor · Off-boarding risk · ×2
  • Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 13 significant file(s) lose their only recent owner: wgpu-core-remote/src/global/render_pass.rs, wgpu-core-remote/src/global/mod.rs, wgpu-core-remote-types/src/encoders.rs, wgpu-core-remote/src/global/command_encoder.rs, wgpu-core-remote/src/global/compute_pass.rs, wgpu-core-remote-types/src/lib.rs, wgpu-core-remote-types/src/binding_model.rs, wgpu-core-remote/src/global/instance.rs (+5 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 3 significant file(s) lose their only recent owner: naga/src/common/wgsl/types.rs, wgpu-core/src/track/range.rs, naga/hlsl-snapshots/src/lib.rs. Pair on, review, or document these before any departure.
D16 · Bus Factor · Further sole-owners (lower concentration) · ×1
  • Further sole-owners (lower concentration) — 4 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 (23 single-owned of 371 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated and example/demo trees and test files identified by path convention, largest first; 371 of the 456 production source files in this repository met that bar). They are anonymized user #3 (2 file(s)), anonymized user #4 (2 file(s)), anonymized user #5 (2 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.
D20 · ADR Quality · No ADRs found · ×1
  • No ADRs found — No ADRs found. No recognised ADR directory (`docs/adr/`, `docs/decisions/`, `adr/`, `docs/rfcs/`, an `ADR0001/` folder, or their siblings) exists anywhere in this tree. What was searched, so you can tell an empty log from a search that missed one: every directory under the tree (build output, dependencies and VCS metadata excepted), for a document that is either any non-index page inside a recognised ADR directory, whatever its name and however deeply nested (`docs/adr/use-postgres.md`, `docs/adr/2024/0001-x.md`); or a file anywhere whose name is ADR-shaped (`0001-use-postgres.md`, `adr-012-caching.md`); or, when neither turned anything up, a document carrying the decision-record signature (an "Architecture Decision Record" heading, or Status / Context / Decision / Consequences as section headings). A decision log that clears none of these — unnumbered files outside any recognised directory, without those headings — is not seen by this check and this row is then wrong. If that is your case, say so rather than renaming anything; otherwise, consider recording architectural decisions in `docs/adr/`.
D34 · Knowledge Freshness · Further orphaned files (smaller) · ×1
  • Further orphaned files (smaller) — 12 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/lex.rs, naga/src/front/atomic_upgrade.rs, naga/src/back/spv/subgroup.rs, wgpu/src/util/encoder.rs, naga/src/front/glsl/mod.rs, naga/src/front/glsl/offset.rs (and 4 more) (15 orphaned of 371 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated and example/demo trees and test files identified by path convention, largest first; 371 of the 456 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.
X9 · Subsumed condition operand · Subsumed condition operand · ×1
  • Subsumed condition operand wgpu-hal/src/gles/adapter.rs:515 — `extensions.contains("GL_OVR_multiview2")` can never decide this `||` — every value satisfying `extensions.contains("GL_OVR_multiview2")` also satisfies `extensions.contains("OVR_multiview2")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
Minor — 3 finding(s)
D12 · Dependency Hygiene · Outdated · ×3
  • Outdated: wasm-bindgen — `wasm-bindgen` is locked at 0.2.128 but 0.2.129 is the current stable release on crates.io, and it already satisfies the `"0.2.127"` requirement declared in examples/standalone/03_hdr_surface/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p wasm-bindgen` and commit the updated REDACTED.
  • Outdated: wasm-bindgen-futures — `wasm-bindgen-futures` is locked at 0.4.78 but 0.4.79 is the current stable release on crates.io, and it already satisfies the `"0.4.77"` requirement declared in examples/standalone/03_hdr_surface/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p wasm-bindgen-futures` and commit the updated REDACTED.
  • Outdated: web-sys — `web-sys` is locked at 0.3.105 but 0.3.106 is the current stable release on crates.io, and it already satisfies the `"0.3.104"` requirement declared in examples/standalone/03_hdr_surface/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p web-sys` and commit the updated REDACTED.

Appendix B — Reproduction & audit trail

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

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

Run 01a0e21e-2c2d-798c-a195-02f39abe5e3d · 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